【发布时间】:2018-04-12 12:42:26
【问题描述】:
我创建了一个具有双向数据绑定的组件
class MyCustom2Way{
@Input() text: string;
@Output() textChange = new EventEmitter<string>();
// MyCustom2Way has something in the template that will
// trigger testChange.emit when user interacts with it
}
现在假设我以这样的形式使用MyCustom2Way:
<form action="" #myForm="ngForm">
<my-custom-2-way [(text)]="model.field" name="field"></my-custom-2-way>
</form>
当用户使用MyCustom2Way 进行迭代时,我如何让MyCustom2Way 变成myForm 脏?
【问题讨论】:
标签: javascript angular data-binding