问题:
I don't understand how to use $scope.$watch and $scope.$apply . 我不明白如何使用$scope.$watch和$scope.$apply 。 The official documentation isn't helpful. 官方文档没有帮助。
What I don't understand specifically: 我不明白的是:
- Are they connected to the DOM? 他们连接到DOM吗?
- How can I update DOM changes to the model? 如何更新对模型的DOM更改?
- What is the connection point between them? 它们之间的连接点是什么?
I tried this tutorial , but it takes the understanding of $watch and $apply for granted. 我尝试了本教程 ,但需要理解$watch和$apply是理所当然的。
What do $apply and $watch do, and how do I use them appropriately? $apply和$watch什么作用,如何正确使用它们?
解决方案:
参考一: https://stackoom.com/question/11PTM/如何在AngularJS中使用-scope-watch和-scope-apply参考二: https://oldbug.net/q/11PTM/How-do-I-use-scope-watch-and-scope-apply-in-AngularJS
来源:oschina
链接:https://my.oschina.net/u/4438370/blog/4312688