Created
October 6, 2019 20:32
-
-
Save AvocadoVenom/c1bdf57af0f559aa02915f8a94786338 to your computer and use it in GitHub Desktop.
Overlay Loading Directive > Loader Component with config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component } from '@angular/core'; | |
| import { LoaderData } from './loader.config'; | |
| @Component({ | |
| selector: 'app-loader', | |
| template: ` | |
| <mat-card> | |
| <mat-card-header> | |
| <mat-card-title> | |
| {{ data.title }} | |
| </mat-card-title> | |
| </mat-card-header> | |
| <mat-card-content> | |
| <mat-progress-bar *ngIf="isProgressBar" mode="query"></mat-progress-bar> | |
| <mat-progress-spinner | |
| *ngIf="isSpinner" | |
| mode="indeterminate" | |
| ></mat-progress-spinner> | |
| </mat-card-content> | |
| </mat-card> | |
| ` | |
| }) | |
| export class LoaderComponent { | |
| constructor(private readonly data: LoaderData) {} | |
| get isSpinner(): boolean { | |
| return this.data.loaderType === 'Spinner'; | |
| } | |
| get isProgressBar(): boolean { | |
| return this.data.loaderType === 'ProgressBar'; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment