WIP: Rearrange code
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { Subscription } from 'rxjs';
|
||||
import {LoadingService} from '../../../core/service/loading.service';
|
||||
import {ProgressSpinner} from 'primeng/progressspinner';
|
||||
import {NgIf} from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-loading-overlay',
|
||||
templateUrl: './loading-overlay.component.html',
|
||||
imports: [
|
||||
ProgressSpinner,
|
||||
NgIf
|
||||
],
|
||||
styleUrls: ['./loading-overlay.component.scss']
|
||||
})
|
||||
export class LoadingOverlayComponent implements OnInit, OnDestroy {
|
||||
loading: boolean = false;
|
||||
private loadingSubscription: Subscription | undefined;
|
||||
|
||||
constructor(private loadingService: LoadingService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadingSubscription = this.loadingService.loading$.subscribe(
|
||||
(loading) => {
|
||||
this.loading = loading;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.loadingSubscription?.unsubscribe();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user