My app have the login page, which require to redirect to another extenal web site. as well I require to use the same login page with another new state
name.
i have made the required changes, But I am getting the error as
Maximum call stack size exceeded
- which I am not able to understand at all. how to overcome with this?
here is my code :
state provider stuff : both are same login controller and html
$stateProvider
.state('login', {
url: '/',
templateUrl: 'app/login/login.html',
controller: 'loginCtrl as ctrl',
data: {
requireLogin: false
}
})
.state('fallback', {
url: '/fallback',
templateUrl: 'app/login/login.html',
controller: 'loginCtrl as ctrl',
data: {
requireLogin: false
}
})
issue :
function stateController($rootScope, $state, fsErr ){
$rootScope.$on("$stateChangeStart", function(event, toState, toParams, fromState, fromParams ) {
if( toState.name === 'login' ){
window.location = 'https://cway.cisco.com/fs/';
event.preventDefault();
}
if( toState.name === 'fallback' ){
console.log('nothing doing') //consoles 1227 times
$state.go("fallback");
event.preventDefault();
return false;
}
})