import { Component, ChangeDetectorRef } from '@angular/core'; import { GlobalService } from './global.service'; import { Router } from '@angular/router'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { isActionInProgress = true; constructor( private globalService: GlobalService, private cdref: ChangeDetectorRef, private router: Router ) { } ngOnInit(): void { this.globalService.getLodingSuccess().subscribe({ next: (data: boolean) => { this.isActionInProgress = data; }, error: () => { this.isActionInProgress = false; } }); } ngAfterContentChecked() { this.cdref.detectChanges(); } }