File
Implements
Methods
ngOnDestroy
|
ngOnDestroy()
|
|
|
isConnected
|
Default value : false
|
|
showLoadContentModal
|
Type : any
|
|
Public
unsubscribe$
|
Default value : new Subject<void>()
|
|
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ResourceService, ConnectionService } from '../../services';
import { takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
@Component({
selector: 'app-network-status',
templateUrl: './network-status.component.html',
styleUrls: ['./network-status.component.scss']
})
export class NetworkStatusComponent implements OnInit, OnDestroy {
isConnected = false;
public unsubscribe$ = new Subject<void>();
showLoadContentModal: any;
constructor(public resourceService: ResourceService,
private connectionService: ConnectionService) { }
ngOnInit() {
this.connectionService.monitor().pipe(takeUntil(this.unsubscribe$)).subscribe(isConnected => {
this.isConnected = isConnected;
});
}
ngOnDestroy() {
this.unsubscribe$.next();
this.unsubscribe$.complete();
}
}
<!--Online/Offline-->
<div>
<div class="status-container p-8 mr-16 my-16" *ngIf="isConnected">
<div class="d-flex flex-ai-center flex-jc-center">
<div class="status-container__icon mr-8">
<img height="37px" src="assets/images/Online.svg" width="24px">
</div>
<div class="fnormal status-container__title">{{resourceService?.messages?.stmsg?.desktop?.onlineStatus}}
</div>
</div>
</div>
<div class="status-container p-8 mr-16 my-16" *ngIf="!isConnected">
<div class="d-flex flex-ai-center flex-jc-center">
<div class="status-container__icon mr-8">
<img height="37px" src="assets/images/Offline.svg" width="24px">
</div>
<div class="fnormal status-container__title">{{resourceService?.frmelmnts?.lbl?.offline}}</div>
</div>
</div>
</div>
<!--/Online/Offline-->
@use "@project-sunbird/sb-styles/assets/mixins/mixins" as *;
.status-container{
border-radius: calculateRem(24px);
background-color: var(--sbt-filter-bar-bg);
position: relative;
z-index: 9;
}
.load-content-section{
border-radius: calculateRem(24px);
background-color: var(--sbt-filter-bar-bg);
position: relative;
z-index: 9;
.load-content-title{
font-size: calculateRem(14px);
}
}
Legend
Html element with directive