How to get rid of split second showing a view before redirecting?

Hi all,

I have this in my main controller:

  if (localStorage['firstTimeLoad']!='TRUE'){
        localStorage['firstTimeLoad']='TRUE';
        $state.go('splash'); 
    }
    else {
        $state.go('home');
    }

So basically, I am saying that I want to send my users to the homepage, UNLESS you are visiting the first time. Then, it should go to the splash screen. This works, but partially.

The problem: the user sees the homepage for one second, before it is being redirected to the splash screen when opening the app for the first time (ever).

Question: how can I get rid of this bug / glitch / split second showing a view it shouldn’t show?

You can try $location.path(url)
where url is the url parameter defined in your router for a particular page

Hi,

How do you mean? Can you provide a snippet / example?

And what would be the difference?