mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-18 08:20:13 +01:00
feat(preloader): preloader service which can take a list of promises and execute smth once all promises are completed
This commit is contained in:
parent
02fdd09bc0
commit
d1f368e571
6 changed files with 63 additions and 4 deletions
|
|
@ -1,5 +1,7 @@
|
|||
import {Component, ViewChild, ViewEncapsulation, Input, Output, ElementRef, EventEmitter} from '@angular/core';
|
||||
|
||||
import {BaThemePreloader} from '../../../theme/services';
|
||||
|
||||
import './baAmChart.loader.ts';
|
||||
import {BaAmChartThemeService} from './baAmChartTheme.service';
|
||||
|
||||
|
|
@ -18,6 +20,7 @@ export class BaAmChart {
|
|||
@ViewChild('baAmChart') private _selector:ElementRef;
|
||||
|
||||
constructor (private _baAmChartThemeService:BaAmChartThemeService) {
|
||||
this._loadChartsLib();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
|
@ -28,4 +31,12 @@ export class BaAmChart {
|
|||
let chart = AmCharts.makeChart(this._selector.nativeElement, this.baAmChartConfiguration);
|
||||
this.onChartReady.emit(chart);
|
||||
}
|
||||
|
||||
private _loadChartsLib():void {
|
||||
BaThemePreloader.registerLoader(new Promise((resolve, reject) => {
|
||||
AmCharts.ready(function(){
|
||||
resolve('AmCharts ready');
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue