2016-11-11 103 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()它是黑客,我们不能这样做 –