angularJS $scope读不到值

有时候使用$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"....>

如此值的传递就解决了

原文地址:https://www.cnblogs.com/LH2014/p/4071357.html