我使用this來創建我的網站,當我創建一個運行方法$ rootScope.on('$ stateChangeStart')並且不工作。下面是代碼:
.run('Url',function($rootScope, $state, $location){
'ngInject' ;
console.log('Is working');
function message(to, toP, from, fromP) {
return from.name + angular.toJson(fromP) + " -> " + to.name + angular.toJson(toP);
}
$rootScope.$on("$stateChangeStart", function(evt, to, toP, from, fromP) {
console.log("Start: " + message(to, toP, from, fromP));
console.log('Not working');
});
第一次登錄時,我下載該網站的工作,但後兩個日誌都沒有,任何想法問題出在哪裏?
仍然沒有工作,任何其他建議? – Wolffyx