Created
October 6, 2019 20:44
-
-
Save AvocadoVenom/5e233aee9087c8a95f21b302e894c5be to your computer and use it in GitHub Desktop.
Overlay Loading Directive > App Component with Loader 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 { Observable, interval } from 'rxjs'; | |
| import { map } from 'rxjs/operators'; | |
| import { LoaderData } from './loader/loader.config'; | |
| @Component({ | |
| selector: 'app-root', | |
| template: ` | |
| <mat-card> | |
| <mat-card-header> | |
| <mat-card-title>Overlay Loading Components</mat-card-title> | |
| </mat-card-header> | |
| <mat-card-content> | |
| <app-table-basic-example | |
| [overlayLoading]="fetchingData$" | |
| [loaderData]="loaderData" | |
| ></app-table-basic-example> | |
| </mat-card-content> | |
| </mat-card> | |
| ` | |
| }) | |
| export class AppComponent { | |
| loaderData: LoaderData = { | |
| loaderType: 'Spinner', | |
| title: 'Reloading data...' | |
| }; | |
| displayOverlay = [true, false]; | |
| fetchingData$: Observable<boolean> = interval(2000).pipe( | |
| map(i => this.displayOverlay[i]) | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment