版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36918222/article/details/78800059
不同的controller间通信,除了rootScope,
还可以通过angular提供的$on,$emit,$broadcast等方法通信。
在A Controller中
$scope.getName= function(){
doSth……
}
$rootScope.$on('xxx',function(){
$scope.getName();
});
在B Controller中
$scope.$emit('xxx');
会直接调用A controller的
getName();