NG-模型绑定不工作的div [英] ng-model binding not working on div

查看:149
本文介绍了NG-模型绑定不工作的div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这两个AngularJS的结合是不工作的股利。我希望我的div可编辑,但它没有发生。有谁请有什么建议可能是错的?同样的绑定工作正常的文本框。这是我的code:

 <输入类型=文本NG模型=userProfile.firstName/>
< D​​IV CLASS =配置文件名CONTENTEDITABLE =真正的NG-模式=userProfile.firstName>< / DIV>


解决方案

请试试这个,它可能会帮助
<一href=\"https://github.com/angular/angular.js/issues/528\">https://github.com/angular/angular.js/issues/528

这是一个3岁多的开放式的问题,成千上万的人想定。它标记为后1.2里程碑功能,而不是一个错误。眼看因为Angular.js上发布1.2.13为2014年2月的,它看起来像在球队没人在乎眼前这个问题。因此,你会更好滚动自己code或用输入坚持 / 的textarea 控制

The two binding of AngularJS is not working on div. I want my div to be editable but it's not happening. Could anybody please suggest what could be wrong? The same binding works fine on textbox. This is my code:

<input type="text" ng-model="userProfile.firstName"/>
<div class="profile-name" contenteditable="true" ng-model="userProfile.firstName"></div> 

解决方案

Please try this, it might help https://github.com/angular/angular.js/issues/528

This is a 3 year old open issue that tons of people would like fixed. It's marked as a post-1.2-milestone and a feature rather than a bug. Seeing as Angular.js is on release 1.2.13 as of Feb 2014, it looks like no one on the team cares about this issue at the moment. As a result you'll be better off rolling your own code or sticking with a input/textarea control.

这篇关于NG-模型绑定不工作的div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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