如何在AngularJS中使用$ scope。$ watch和$ scope。$ apply?
问题: 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 什么作用,如何正确使用它们? 解决方案: 参考一: