AngularJS:更新输入一个动态NG-模型上的每个按键preSS模糊 [英] AngularJS: Updating an input with a dynamic ng-model blurs on each key press
问题描述
的jsfiddle来演示该问题: http://jsfiddle.net/yoxigen/xxTJc/
jsFiddle to demonstrate the problem: http://jsfiddle.net/yoxigen/xxTJc/
我建立一个小的表单编辑对象的所有属性。对于这一点,我对性的中继器。每个属性都有其输入:
I'm building a small form to edit all of an object's properties. For that, I have a repeater for the properties. Each property has its input:
<ul ng-controller="myController">
<li ng-repeat="(property, value) in obj">
<input ng-model="obj[property]"/><span>{{value}}</span>
</li>
</ul>
每个时间关键是在输入pssed $ P $,值旁边更新正确,但输入失去焦点。任何想法,这可怎么固定?
Each time a key is pressed in an input, the value next to it updates properly, but the input loses focus. Any idea how this can be fixed?
推荐答案
从谷歌论坛:
的问题是,与每一个模型更改对象的
NG-重复再生的整个阵列等模糊你的输入框。
你需要做的是包装您的字符串对象
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
这篇关于AngularJS:更新输入一个动态NG-模型上的每个按键preSS模糊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!