【发布时间】:2016-10-06 04:20:54
【问题描述】:
我写了这个组件:
@Component({
selector: 'formfield',
template: `
<div>
<label>{{label}}</label>
<div>
<input class="form-control" type="text" [(ngModel)]="model">
</div>
</div>
`
})
export class Formfield {
@Input() label: string;
@Input() model: string;
}
我在这里使用它:
<formfield label="something" model="somevalue"></formfield>
毫不奇怪,输入字段显示字符串“somevalue”。我怎样才能让它保持变量 somevalue 的值?
【问题讨论】:
-
是........
标签: binding angular web-component