In my angularjs app, I am checking if user lands on landing page and is already authenticated, then redirect him to home page.
.state(\'landingpage\', {
There can be two solutions to your problem
Firstly you can emit an event and the listener will handle your state transition. You can implement the listener in anywhere in a parent controller
Secondly you can implement the $stateChangeStart hook and check your redirection condition there
$rootScope.$on('$stateChangeStart', function (event, toState) {
if (toState.name === 'landingpage') {
if (!isAuthenticated()) { // Check if user allowed to transition
event.preventDefault(); // Prevent migration to default state
$state.go('home.dashboard');
}
}
});