Since we cannot inject $scope
inside controllers in Angular 1.4+, how can we watch expressions the way we used to do with $scope.$watch
?
An attempt to inject $scope
can be seen here ("Could not instantiate controller" error), and tutorials tells us that:
Angular wont be able to instantiate the controller if we pass $scope
in it. It defines its observable properties on this.
(source)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…