jsFiddle来演示问题:
http://jsfiddle.net/yoxigen/xxTJc/
我正在构建一个小表单来编辑对象的所有属性.为此,我有一个中继器的属性.每个属性都有其输入:
<ul ng-controller="myController"> <li ng-repeat="(property,value) in obj"> <input ng-model="obj[property]"/><span>{{value}}</span> </li> </ul>
每次在输入中按下一个键时,其旁边的值将正确更新,但输入将失去焦点.有什么想法可以如何解决?
解决方法
从
google forums:
The problem is that with every change to the model object the ng-repeat regenerates the whole array and so blurs your input Box. What you need to do is wrap your strings in objects