<input-directive model="config.shared.product.whatevers[0]"></input-directive>
<!-- above works, below doesn't bind properly -->
<td ng-repeat="whatever in config.shared.product.whatevers track by $index">
<input-directive model="whatever"></input-directive>
</td>
基本上,当模型位于 ng-repeat 内时,模型不会从这个完全工作的指令中更新。它可以读取该值,但当我更改输入的值时不会更新。如果您需要更多代码,请告诉我!
最佳答案
找到了解决方案。我正在使用基元。
我的目标:
{ 香蕉:[1,2,3,4,5] }
但是,要在 ng-repeat 中使用它,请执行以下操作:
{ Bananas: [ { value:1 }, { value:2 }... ] }
并引用该值。我确信有一种更干净的方法可以做到这一点。
关于javascript - ng-repeat 破坏指令模型绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37119378/