今天遇到了个问题,js代码中变量已经变化了,但是html页面中没有正常的显示出来。
代码如下:
<input type="text" ng-model="paramValue" auto-focus> $scope.paramValue = param;
以上代码就会造成有时input框中无内容的情况,打断点显示$scope.paramValue是有值的,但是页面就是啥都显示不出来。
换成下边代码就没问题了:
<input type="text" ng-model="searchdata.paramValue" auto-focus> $scope.searchdata.paramValue = param;
这个bug很少遇到,我这几年是第一次遇到,记录一下。
以上这篇解决angular双向绑定无效果,ng-model不能正常显示的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持北冥有鱼。
您可能感兴趣的文章:
- 解决angular2在双向数据绑定时[(ngModel)]无法使用的问题
- AngularJS解决ng-if中的ng-model值无效的问题
- 解决ng-repeat产生的ng-model中取不到值的问题
- Angularjs 双向绑定时字符串的转换成数字类型的问题
- 浅谈AngularJs 双向绑定原理(数据绑定机制)