In my application I am running a function after route-config. in the function i am checking the login status, and accordingly trying to redirecting to login page. But it's not working,
here is the function how i call :
angular.module('meanOffice') .config(routeConfig) .run(stateController); function stateController( $rootScope, auth, authToken, $state ){ $rootScope.$on("$stateChangeStart", function(){ var isLoggedIn = auth.isLoggedIn(); console.log( $state.current.url )// consoles as ^ if(!isLoggedIn) { $state.go('/'); // Could not resolve '/' from state '' } }) } How to fix this? what is wrong here? any one help me.
// Could not resolve '/' from state ''$state.go('login', {});- there is no error exist. But my page is not redirected to login state, login state is exist already