首页 > Web开发 > 详细

angularJS $scope读不到值

时间:2014-11-03 16:17:10      阅读:534      评论:0      收藏:0      [点我收藏+]

有时候使用$scope时无法从html中读取到值,也就是ng-model中绑定的值无法传给angular使用

原因:

在Js中你或许使用了这样的方法定义scope变量,$scope.show = ""

html:  .....................  <... ng-model = "show"....>

这样的话html中的hello值无法传送给js处理

解决办法

js: $scope.post = {  show : ‘‘  }

html :  .....................  <... ng-model = "post.show"....>

如此值的传递就解决了

angularJS $scope读不到值

原文:http://www.cnblogs.com/LH2014/p/4071357.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!