Skip to content
Snippets Groups Projects
Select Git revision
  • 5b5db024da037f36f7734697d87ce2034e30e3b6
  • master default
2 results

loader.component.ts

Blame
  • 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();
    }
    
    }