$watch represents the listener of the data source, and when the data source changes, the second parameter's callback function is triggered
$digest represents an event that triggers a change in the data source
$apply represents a package for $digest, he has one more parameter.
$watch
$digest
is used to trigger a listener event manually, usually without the need for manual triggering, but by $apply to invoke
$apply
Just put $digest in a package, to provide manual triggering, then why need to manually trigger it, under normal circumstances, in angular, modify the data source will automatically trigger, but if not in the context of angular, such as browser DOM events, settimeout execution, In this case, angular cannot get to the event, so, by using apply to manually trigger, in the parameters of apply to modify the data source
$observe
attr, which is actually the attribute parameter on the defined element, can get the parameter in the DOM by attr;
through $observe to listen, when the value of the parameter changes, it will trigger a callback function, The difference between him and watch is that the listener's host object is different
The difference between angular's $watch and $digest and $apply and $observe