【发布时间】:2017-07-11 02:06:24
【问题描述】:
我在我的 Angular 应用程序中有一个动态创建的组件,如下所示:
const factory = this.resolver.resolveComponentFactory<IMessage>(MessageComponent);
this.component = this.container.createComponent(factory);
this.component.instance.body = message;
相当于在组件的HTML中添加<message [body]="message"></message>。
假设,我想在我的动态组件代码中实现这样的功能:
<message [body]="message" #form="my-form" (change)="myFunction()"></message>
如何通过组件的 ts 文件绑定这些额外的变量和更改事件?
【问题讨论】: