84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
双向绑定,一般来说是这样
<input ng-model="object.xxx"> <span ng-bind="object.xxx"></span>
也就是说ng-bind是相当于{{object.xxx}},是用于展示数据的。而ng-model是控制数据的。
{{object.xxx}}
但在这里,我从后台获取到设备号后,输出到页面,对input使用的是ng-model,使用ng-bind是没有反应的,为什么?
<input type="text" ng-value="object.xxx" readonly="readonly" />
http://stackoverflow.com/a/12420157/2586541
$('#input1').html('123'); //ng-bind $('#input1').val('123'); //ng-value
How did you obtain the device number?
If you implement ajax yourself, you need to manually $scope.$apply(); after getting the data If $http is used to obtain data, angular will automatically call $apply().
ng-bind is a one-way binding from $scope -> view ng-modle is a two-way binding from $scope <-> view
http://stackoverflow.com/a/12420157/2586541
How did you obtain the device number?
If you implement ajax yourself, you need to manually $scope.$apply();
after getting the data If $http is used to obtain data, angular will automatically call $apply().
ng-bind is a one-way binding from $scope -> view
ng-modle is a two-way binding from $scope <-> view