Skip to content

Instantly share code, notes, and snippets.

@AvocadoVenom
Created October 6, 2019 20:44
Show Gist options
  • Select an option

  • Save AvocadoVenom/5e233aee9087c8a95f21b302e894c5be to your computer and use it in GitHub Desktop.

Select an option

Save AvocadoVenom/5e233aee9087c8a95f21b302e894c5be to your computer and use it in GitHub Desktop.
Overlay Loading Directive > App Component with Loader Config
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