src/app/core/spinner/spinner.component.ts
selector | crm-spinner |
styleUrls | spinner.component.css |
template |
|
Properties |
|
Methods |
constructor(spinnerService: SpinnerService)
|
||||||||
Defined in src/app/core/spinner/spinner.component.ts:19
|
||||||||
Parameters :
|
ngOnDestroy |
ngOnDestroy()
|
Defined in src/app/core/spinner/spinner.component.ts:31
|
Returns :
void
|
ngOnInit |
ngOnInit()
|
Defined in src/app/core/spinner/spinner.component.ts:24
|
Returns :
void
|
Private spinnerStateChanged |
spinnerStateChanged:
|
Type : Subscription
|
Defined in src/app/core/spinner/spinner.component.ts:19
|
visible |
visible:
|
Default value : false
|
Defined in src/app/core/spinner/spinner.component.ts:17
|
import {Component, OnInit, OnDestroy} from '@angular/core';
import {Subscription} from "rxjs";
import {SpinnerService} from "./spinner.service";
import {SpinnerState} from "./spinner-state";
@Component({
selector: 'crm-spinner',
template: `
<div class="spinner-wrapper" [class.spinner-hidden]="!visible">
<div class="loader"></div>
</div>
`,
styleUrls: ['./spinner.component.css']
})
export class SpinnerComponent implements OnInit, OnDestroy {
visible = false;
private spinnerStateChanged: Subscription;
constructor(private spinnerService: SpinnerService) {
}
ngOnInit() {
this.spinnerStateChanged = this.spinnerService.spinnerState
.subscribe((state: SpinnerState) => {
this.visible = state.show;
})
}
ngOnDestroy() {
this.spinnerStateChanged.unsubscribe()
}
}