While working with my Hybrid Mobile Application with Ionic framework, often I need to clear navigation history and redirect users to Login page. Also needs to make sure, On login and logout I need to reload the page, in order to refresh the data, however, $state.go(‘homePage’) takes the user back to the view without reloading - the controller behind it is not called.

The routing in Ionic is powered by ui-router AngularJS module.

Solution:

There are couple of ways to solve this problem.

This will just reload the state

1
$state.go($state.current, {}, {reload: true});

This will actually reload the page

1
$window.location.reload(true)

Using any of those solution will fix your problem.