How do I use $scope.$watch and $scope.$apply in AngularJS?
I don't understand how to use $scope.$watch
and $scope.$apply
. The official documentation isn't helpful.
What I don't understand specifically:
- Are they connected to the DOM?
- How can I update DOM changes to the model?
- What is the connection point between them?
I tried this tutorial, but it takes the understanding of $watch
and $apply
for granted.
What do $apply
and $watch
do, and how do I use them appropriately?