在 angular 中关闭 debuggingData 后,还有其他方法可以获取 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。在 angular 中是否有另一种方法可以在不启用此调试功能的情况下获取 $rootScope?
要访问 $rootScope
你可以
angular.element(document).injector().get('$rootScope')
我认为在 Angular 中默认启用调试信息会导致大型应用下沉。您现在可以在生产中禁用它:
https://docs.angularjs.org/guide/production#disabling-debug-data
但有些情况我会这样做:
angular.element(文档).scope()
为了访问rootScope。在 angular 中是否有另一种方法可以在不启用此调试功能的情况下获取 $rootScope?
要访问 $rootScope
你可以
angular.element(document).injector().get('$rootScope')