frontend-tutorial-framework/src/app/loader/loader.component.ts

30 lines
724 B
TypeScript

import { Component, Input, AfterViewInit, OnInit } from '@angular/core';
import { ConfigReadyService } from '../services/config.service';
@Component({
selector: 'app-loader',
templateUrl: './loader.component.html',
styleUrls: ['./loader.component.scss']
})
export class LoaderComponent implements OnInit, AfterViewInit {
@Input() toBlur: HTMLElement;
loading = true;
constructor(private configReadyService: ConfigReadyService) {}
ngOnInit() {
this.configReadyService.init();
}
ngAfterViewInit() {
this.toBlur.classList.add('blur');
this.configReadyService.configDone.subscribe(
() => {
this.loading = false;
this.toBlur.classList.remove('blur');
}
);
}
}