AngularJS:更新输入一个动态NG-模型上的每个按键preSS模糊 [英] AngularJS: Updating an input with a dynamic ng-model blurs on each key press

查看:126
本文介绍了AngularJS:更新输入一个动态NG-模型上的每个按键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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆