2016-11-11 100 views
3

我使用Angular 2 + TypeScript。現在正在進行添加angular2-busy。Angular2動態組件

對於這個庫我需要包含angular2-dynamic-component,但我不知道我必須用它做什麼。

這是錯誤 enter image description here

這是APP模塊

import {BusyModule} from 'angular2-busy/build/src'; 
import {DynamicComponentModule} from 'angular2-dynamic-component' 

@NgModule({ 
imports: [   
    BusyModule, 
    DynamicComponentModule 
], 

什麼是錯的,如何解決呢?

UPDATE angular2忙/ busy.component.js

BusyComponent = __decorate([ 
    core_1.Component({ 
     selector: 'ng-busy', 
     template: "\n  <div [class]=\"wrapperClass\" *ngIf=\"isActive()\" @flyInOut>\n   <DynamicComponent [componentTemplate]=\"template\" [componentInputData]=\"context\">\n   </DynamicComponent>\n  </div>\n ", 
     animations: [ 
      core_1.trigger('flyInOut', [ 
       core_1.transition('void => *', [ 
        inactiveStyle, 
        core_1.animate(timing) 
       ]), 
       core_1.transition('* => void', [ 
        core_1.animate(timing, inactiveStyle) 
       ]) 
      ]) 
     ] 
    }), 
    __metadata('design:paramtypes', [promise_tracker_service_1.PromiseTrackerService]) 
], BusyComponent); 
return BusyComponent; 

這是出現錯誤的位置。

+0

什麼是「angular2動態分量」? –

+0

你想用這個[componentInputData]屬性來實現什麼?假設它是該指令,我在https://www.npmjs.com/package/angular2-dynamic-component中看不到任何此類屬性。 –

+0

我不知道爲什麼它需要,但我不能包括angular2-busy,如果你有一些命題,請 –

回答

2

之前,我也有這個問題,我解決它通過刪除如下:

<DynamicComponent [componentTemplate]=\"template\" [componentInputData]=\"context\">\n   </DynamicComponent>\n  </div>\n 
+0

之前添加@Input()它是黑客,我們不能這樣做 –