Select Git revision
loader.component.ts
loader.component.ts 1.01 KiB
import { Component, OnInit,ChangeDetectionStrategy, SimpleChanges, ChangeDetectorRef } from '@angular/core';
import { LoaderService } from '../../../services/loader.service';
import { BehaviorSubject, Subject } from 'rxjs';
import { threadId } from 'worker_threads';
@Component({
selector: 'ngx-loader',
templateUrl: './loader.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
styleUrls: ['./loader.component.scss']
})
export class LoaderComponent implements OnInit {
isLoading;
noLoader;
constructor(private loaderService: LoaderService, private changeDetectorRef: ChangeDetectorRef) {
changeDetectorRef.detach();
setInterval(() => { this.changeDetectorRef.detectChanges(); }, 500);
}
get isLoadingValue(){
return this.isLoading;
}
ngOnInit(): void {
this.loaderService.loader.subscribe(color => {console.log(color);
this.isLoading = color;
//
});
this.changeDetectorRef.detectChanges();
//this.isLoading = this.loaderService.isLoading$.getValue();
}
}