@@ -13,8 +13,9 @@ var core_1 = require("@angular/core");
1313var fusioncharts_service_1 = require ( "./fusioncharts.service" ) ;
1414var fusioncharts_constructor_1 = require ( "./fusioncharts.constructor" ) ;
1515var FusionChartsComponent = ( function ( ) {
16- function FusionChartsComponent ( element , fusionchartsService , differs ) {
16+ function FusionChartsComponent ( element , fusionchartsService , differs , zone ) {
1717 this . differs = differs ;
18+ this . zone = zone ;
1819 this . oldDataSource = this . dataSource ;
1920 this . constructerParams = {
2021 type : true ,
@@ -81,6 +82,7 @@ var FusionChartsComponent = (function () {
8182 // @ViewChild ('samplediv') chartContainer: ElementRef;
8283 FusionChartsComponent . prototype . ngOnInit = function ( ) {
8384 this . oldDataSource = JSON . stringify ( this . dataSource ) ;
85+ this . placeholder = this . placeholder || 'FusionCharts will render here' ;
8486 } ;
8587 FusionChartsComponent . prototype . ngOnChanges = function ( changes ) {
8688 for ( var _i = 0 , _a = Object . keys ( changes ) ; _i < _a . length ; _i ++ ) {
@@ -142,16 +144,22 @@ var FusionChartsComponent = (function () {
142144 _this . chartObj = fusioncharts_constructor_1 . FusionChartsConstructor ( _this . fusionchartsService , configObj ) ;
143145 // configObj['renderAt'] = 'container-' + _this.chartObj.id;
144146 // _this.containerId = _this.chartObj.id;
145- setTimeout ( function ( ) {
146- _this . chartObj . render ( _this . element . nativeElement . querySelector ( 'div' ) ) ;
147- } , 1 ) ;
147+ this . zone . runOutsideAngular ( function ( ) {
148+ setTimeout ( function ( ) {
149+ _this . chartObj . render ( _this . element . nativeElement . querySelector ( 'div' ) ) ;
150+ } , 1 ) ;
151+ } ) ;
148152 }
149153 } ;
150154 FusionChartsComponent . prototype . ngOnDestroy = function ( ) {
151155 this . chartObj . dispose ( ) ;
152156 } ;
153157 return FusionChartsComponent ;
154158} ( ) ) ;
159+ __decorate ( [
160+ core_1 . Input ( ) ,
161+ __metadata ( "design:type" , String )
162+ ] , FusionChartsComponent . prototype , "placeholder" , void 0 ) ;
155163__decorate ( [
156164 core_1 . Input ( ) ,
157165 __metadata ( "design:type" , Object )
@@ -383,9 +391,9 @@ __decorate([
383391FusionChartsComponent = __decorate ( [
384392 core_1 . Component ( {
385393 selector : 'fusioncharts' ,
386- template : "<div attr.id=\"container-{{containerId}}\" >FusionCharts will render here </div>\n " ,
394+ template : "<div attr.id=\"container-{{containerId}}\" >{{placeholder}} </div>\n " ,
387395 providers : [ fusioncharts_service_1 . FusionChartsService ] ,
388396 } ) ,
389- __metadata ( "design:paramtypes" , [ core_1 . ElementRef , fusioncharts_service_1 . FusionChartsService , core_1 . KeyValueDiffers ] )
397+ __metadata ( "design:paramtypes" , [ core_1 . ElementRef , fusioncharts_service_1 . FusionChartsService , core_1 . KeyValueDiffers , core_1 . NgZone ] )
390398] , FusionChartsComponent ) ;
391399exports . FusionChartsComponent = FusionChartsComponent ;
0 commit comments