![](/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.