order.run(['$rootScope','$window','loginSe',function ($rootScope,$window,loginSe) {
var aid=getCookie('aid');
var sid=getCookie('sid');
if(1>0){
loginSe.check(aid,sid).then(function (data) {
if(data.success==true){
$rootScope.$broadcast('load', {loginState:1})
}
else{
$window.location.href='../../loginPage/MainView.html';
}
})
}
else{
$window.location.href='../../loginPage/MainView.html';
}
}])
下面这个controller可以收到消息
order.controller('loginIn', ['loginSe','$scope',loginIn]);
function loginIn(loginSe,$scope) {
var self=this;
this.loginState=0;
$scope.$on('load',function (event,data) {
self.loginState=data.loginState;
self.headPic=localStorage.headPic;
})
this.loginSe=loginSe;
this.floatM=0;
}
下面这个就不行
order.controller('wait', ['$scope', '$interval', '$stateParams', '$location','oFirst', function ($scope, $interval, $stateParams, $location,oFirst) {
$scope.$on('load',function (event,data) {
console.log('s') })
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
你下面这个ctrl是被激活的么?很有可能下面这个ctrl在你$broadcast 的时候没被运行起来。