Best way to navigation after login

After a successful login, to navigate back home I do $state.go('app.home'); but that makes the ion-nav-back-button show which I don’t want because they shouldn’t be able to navigate back to the login. So I think I need to basically navigate in the controller with a nav-clear. Or am I completely missing something? Thanks!

2 Likes

I’m beginner in Ionic and I’m also have this problem with navigation between login and home pages.
How can resolve this problem today? Please help me.
Which decisions best we are have for today?

Thank you )!

That’s right, it works pretty good. But i noticed i can even get back using the physical button, even if i cleared the history. How can avoid the back navigation?

In the controller that handles the ‘app.home’ state add this to the top

$ionicViewService.clearHistory();

(you’ll need to include $ionicViewService as param to your controller)

1 Like

That seems to work but one thing I notice is. The app.home controller fades in from the right like it came from a view it can go back on. WIll adding nav-clear to the login form do it?

Thank you! This decision (nav-clear) working nice!

1 Like

Did you implement the nav-clear in the controller or what did you do? I need to do it before a redirect after a form submit.