![](/img/trans.png)
[英]From run block can i able to call angular scope function inside another controller instead of $rootscope
[英]Once I turn off debuggingData in angular, is there another way to get the rootscope?
我认为默认情况下在Angular中启用调试信息会沉没大型应用程序。 您现在可以在生产环境中禁用此功能:
https://docs.angularjs.org/guide/production#disabling-debug-data
但是在某些情况下,我会这样做:
angular.element(文件).scope()
为了访问rootScope。 如果没有启用此调试功能,是否还有其他方法可以获取$ rootScope?
要访问$rootScope
您可以执行
angular.element(document).injector().get('$rootScope')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.