Transitioning between views without navigation

I’m trying to understand how I can transition between views in Ionic. Every time I do a $state.go it just pushes yet another view onto the stack. I want to go to a new screen without retaining any prior screen in memory anywhere, and without the ability to back. One example of this is that I have a loading screen when the app starts, and then it switches to my main tabbed view controller. But I want my loading screen ui to be completely discarded from memory. I JUST started trying out ionic and am fairly new to javascript so please don’t assume I know anything in your answer.

Try this:

$state.go('someView', {}, {location: 'replace'});
2 Likes

Thanks. This sounds perfect!

Unfortunately, that did not work as expected :(. If I come back to the original view later on, all its state was retained and so basically the view was never destroyed. I want to be able to move to a new state while making sure the old state is no longer retained in memory. Can someone please show me how to completely deallocate the prior view controller?

try

$ionicHistory.clearHistory() in your tabbed view controller which loads after the loading screen. This removes the previous history and going back does not work.

Ok thanks I’ll do that. Also what helped me was using ion-view cache-view=“false” in my source view controller.

Ok I ended up needing to use the clearHistory anyway because of an occasional back button that was showing up; this fixed that. Thanks!