小编Ash*_*S H的帖子

ngFor中的Angular2 ngModel(数据不绑定输入)

这是我的Angular2应用程序,其中包含表格中的输入字段.我的数据显示在select标签上,但使用ngModelon input标签绑定的数据未显示在input字段中.

<form name="userForm">
<table>
<tr *ngFor="let item of itemList; let in =index">
  <td><select><option >{{item.FirstName}}</option></select></td>
  <td><input type="text" id="lastname" name="lastname" [(ngModel)]="itemList[in].lastname"></td>
  <td><input type="text" id="middlename" name="middlename" [(ngModel)]="itemList[in].middlename"></td>
</tr>
</table>
</form>
Run Code Online (Sandbox Code Playgroud)

angular

34
推荐指数
1
解决办法
3万
查看次数

标签 统计

angular ×1