【发布时间】:2019-06-13 12:16:59
【问题描述】:
所以我有以下错误:
鉴于我有以下模型:
Item {
key: string,
name: string,
data: {
sectionA: string,
sectionB: string,
...
sectionZ: string
}
}
我想通过循环动态绑定基于数组 [A-Z] 的输入文本
房间 = ["A", "B", ... , "Z"]
<div
class="item"
ng-repeat="room in rooms"
>
<input type="text"
name="{{ item.key }}"
class="form-control"
ng-model="item.data.section"+ room >
</div>
似乎当我循环时,我从咖啡脚本中收到关于模型无效的错误,所以我的问题是如何为模型设置正确的值。
【问题讨论】: