File
Implements
Index
Properties
|
|
Methods
|
|
Inputs
|
|
Methods
ngOnDestroy
|
ngOnDestroy()
|
|
|
countDown
|
Type : Subscription
|
|
import { Component, OnInit, Input, OnDestroy } from '@angular/core';
/* tslint:disable */
import * as _ from 'lodash'
import { Subscription, timer } from 'rxjs';
import { DiscussionService } from '../../services/discussion.service';
/* tslint:enable */
@Component({
selector: 'lib-app-loader',
templateUrl: './app-loader.component.html',
styleUrls: ['./app-loader.component.css']
})
export class AppLoaderComponent implements OnInit, OnDestroy {
@Input() data;
headerMessage: string;
loaderMessage: string;
countDown:Subscription;
constructor(
private discussionService: DiscussionService
) { }
ngOnInit() {
this.headerMessage = 'Please wait';
this.loaderMessage = 'We are fetching details';
if (this.data) {
this.headerMessage = _.get(this.data, 'headerMessage') || this.headerMessage;
this.loaderMessage = _.get(this.data, 'loaderMessage') || this.loaderMessage;
}
this.countDown = timer(10000)
.subscribe(() => {
this.discussionService.alertEvent.next()
});
}
ngOnDestroy(){
this.countDown.unsubscribe();
}
}
<ng-container>
<div class="dt-app-loader-container">
<img src="./assets/discussion-ui/images/loader-icon.svg" width="50px">
<div class="loader-content">
<div class="loader-label">
{{headerMessage}}
</div>
<p>{{loaderMessage}}</p>
</div>
</div>
</ng-container>
.dt-app-loader-container {
background: var(--gray-100);
width: 94% !important;
margin: 1rem auto;
border-radius: 1.5rem;
border: 0px;
display: flex;
padding: 1rem;
}
.loader-content{
margin: 0 1rem;
font-size: 0.875rem;
}
.loader-label{
font-weight: bold;
margin-bottom: 0.25rem;
}
Legend
Html element with directive