Angular2动态组件

标签 angular typescript angularjs-directive angular-animations

我使用 Angular 2 + TypeScript。现在正在添加 angular2-busy。

对于这个库,我需要包含 angular2-dynamic-component,但我不知道我必须用它做什么。

这是错误 enter image description here

这是应用模块

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

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

出了什么问题以及如何解决?

更新 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;

这是错误出现的地方。

最佳答案

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

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

关于Angular2动态组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40544138/

相关文章:

javascript - 如何使用 ReactJS 和 Typescript 定义组件实例属性? `Property ' var' 在类型 'App' ` 上不存在

javascript - AngularJS 指令 - 链接函数元素参数在监视函数中不可用

AngularJS : Differences among = & @ in directive scope?

ios - ionic 2 中适用于 IOS 的 Google map 自动完成功能

angular - 如何在angular 9的主窗口中的弹出窗口中捕获来自linkedin登录页面按钮的事件

javascript - 合并图像函数导致 iOS 上的混合应用程序结果不正确 - 适用于 Safari

typescript - Typescript 中每个文件的显式全局变量

javascript - 如何将 $scope 传递给 angularjs 1.5 组件/指令

asp.net - "The requested resource does not support http method ' 发布'

javascript - 如何在 Angular 4 模块中延迟加载库?