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)
I ran into this and needed an npm package; no good having everyone on the team build from source for the time being. We released an interim package on npm that fixes this issue:
npm install loomio-angular-router@0.5.7
Note: you may need to rename ng-viewport to ng-outlet to get the interim package working.
you have $watch available in .activate. Check bellow (copy paste from my app).
I have just found out that there is a bug on ngNewRouter causing this problem. It has been fixed, but haven't been released yet.
To workaround it, try this:
after that, copy the dist files to your project