【发布时间】:2017-07-30 04:06:04
【问题描述】:
我想知道:如何将模板中选择器使用的组件的值与模型中声明的对象绑定?
FormComponent 具有选择器“interface-form”。
代码如下:
@Component({
moduleId: 'module.id',
selector: 'create-interface',
template: '
<div class="content" style="margin : 20px;">
<div class="header-section row">
<button class="btn"> < Retour</button>
</div>
<interface-form [data]="data" [dataFields]="this.form.dataFields">
</interface-form>
</div>'
})
export class CreateComponent {
public form: FormComponent;
...
我希望我的表单属性是我的模板中声明的接口表单的实例,所以如果我这样做:
this.form.addField(...),我的模板会动态变化。
【问题讨论】:
标签: angular