It seems that it was assigned a value for the first time, and then modifying $scope.XXX in the controller has no effect.
光陰似箭催人老,日月如移越少年。
Please use $watch
! Please check the documentation for detailed usage, and also see this article, for novices.
Data binding is a major feature of Angular. The data bound to the page is all located at the current level (as well as the parent, grandparent...)Controller
的$scope
下。你可以通過設(shè)置$scope
to share data with the template.
Not sure what your problem is?
ng-bind
in the template; ng-model
in the template. Pay attention to the two-way binding to the form input control that it acts on, such as input
, select
etc.
For more information about the working mechanism of AngularJS data binding and the timing of data refresh in the view, you can refer to this blog:
http://harttle.github.io/2015/06/06/angular-data-binding-and-digest.ht...