我们怎样才能收看采用了棱角分明的全新路由器控制器内的前pressions在1.4角 [英] How can we watch expressions inside a controller in angular 1.4 using angular-new-router
问题描述
由于我们不能注入 $范围
里的控制器在角1.4+,我们怎么能看前pressions我们习惯的方式做 $范围。$看
?
这是试图注入 $范围
可以看到的这里(无法实例化控制器的错误),和教程告诉我们:
角不会能如果我们通过$范围实例控制器
在里面。它定义在此其显着特性。
(源)
块引用>解决方案我碰到了这一点,需要一个NPM包;在球队没有很好的有大家从源代码编译暂时。我们发布了故宫临时包,修复了这个问题:
NPM安装loomio-angular-router@0.5.7
注意:您可能需要为重命名NG-视口NG-出口以获得临时工作包
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.
这篇关于我们怎样才能收看采用了棱角分明的全新路由器控制器内的前pressions在1.4角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!