angularjs – 在Angular2中动态设置ngModel值

有没有办法可以动态设置ngModel的值?例如

<h1>please fill the text</h1>
<div *ngFor="#value of columnsNames">
    {{value }}<input type = "text" [(ngModel)]="SomeDynamicValue">
</div>

最佳答案

<div *ngFor="#value of columnsNames">
    {{value }}<input type = "text" [(ngModel)]="SomeDynamicValue[value]">
</div>
点赞