github.com/fanux/shipyard@v0.0.0-20161009071005-6515ce223235/controller/static/app/shipyard.js (about) 1 (function() { 2 'use strict'; 3 4 angular 5 .module('shipyard') 6 .run( 7 ['$rootScope', '$state', '$stateParams', '$window', 'AuthService', 8 function ($rootScope, $state, $stateParams, $window, AuthService) { 9 $rootScope.$state = $state; 10 $rootScope.$stateParams = $stateParams; 11 $rootScope.url = "http://192.168.86.106:8081" 12 13 $rootScope.$on("$stateChangeStart", function(event, toState, toParams, fromState, fromParams) { 14 $rootScope.username = AuthService.getUsername(); 15 }); 16 17 $rootScope.$on("$stateChangeError", function(event, toState, toParams, fromState, fromParams) { 18 event.preventDefault(); 19 console.log("$stateChangeError", event, toState, toParams, fromState, fromParams); 20 $state.transitionTo('error'); 21 }); 22 23 $rootScope.$on("$stateChangeSuccess", function(event, toState, toParams, fromState, fromParams) { 24 }); 25 } 26 ] 27 ) 28 })();