简体   繁体   English

最好对angularjs中的angularjs加载器指示器使用$ rootScope。$ emit或$$ rootScope。$ broadcast

[英]which is best to use $rootScope.$emit or $$rootScope.$broadcast for angularjs loader indicator in angularjs

$rootScope.$emit flows up to $rootScope and $rootScope.$broadcast flows down the scope to $rootScope and all $scope's in angularjs. $ rootScope。$ emit上升到$ rootScope和$ rootScope。$ broadcast下降到$ rootScope和所有$ scope在angularjs中。 I am still confused of what exactly to use for angularjs loader indicator . 我仍然对为angularjs loader指标确切使用什么感到困惑。

$rootScope.$emit only lets other $rootScope listeners catch it. $rootScope.$emit仅允许其他$rootScope侦听器捕获它。 This is good when you don't want every $scope to get it. 当您不希望每个$ scope获得它时,这很好。

$rootScope.$broadcast is a method that lets pretty much everything hear it. $rootScope.$broadcast是一种几乎可以让所有人听到的方法。

This might help, You can refer to the original answer from here 这可能会有所帮助,您可以从此处参考原始答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM