简体   繁体   中英

Angular2 dynamic component

I work with Angular 2 + TypeScript. Right now in progress to add angular2-busy.

For this library I need to include angular2-dynamic-component, but I don't know what I must do with it.

This is error 在此输入图像描述

This is App Module

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

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

What is wrong and how to fix it?

UPDATE angular2-busy/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;

This is where the error appears.

我以前也遇到过这个问题,我通过删除以下内容解决了这个问题:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM