You shouldn’t conditionally set the rootPage asynchronously. The rootPage is set right away, but if some asynchronous operation is performed first (like checking if a user is authenticated) before determining the rootPage, it’s going to cause issues.
I handle this by setting the root page to the login page, and then on the login page trigger the authentication check within ionViewDidLoad and once it completes, use setRoot to change the page (if necessary).
Hey Josh,
Glad to see your answer. I tried your way. But it shows the login page about 2-3 seconds even im logged in. After that, it changes to TabsPage. Also, if I logout and turn to Login page with setRoot(), I see tabs on my login page. This was pretty weird.
So I had to create another page which is called “initial-page”. All this does checking authentication and setRoot to Login or TabsPage. It works but it increases boot time. So I’m still looking for the best way.
Sure, something needs to display during the 2-3 seconds it takes to do the check. I still like to stick to just doing it with the login page. Usually I will just throw up a “Authenticating…” loading overlay whilst it performs the check, if they are logged in then swap pages, if not then just hide the overlay.
Hola, yo solucioné ese problema de que la aplicación se quedaba con la pantalla en blanco agregando esta línea de código en la página root, en mi caso la página de LOGIN es mi root y justo allí es donde válido si hay una sesión iniciada.
Hi Josh. I came here while trying to figure out why (or how) I might be able to control the window.open() whilst trying to get token back from a call to OAuth API. It shows my OAuth content fine, but when it returns/redirects to my localhost:8100/null instead of something like localhost/#/some-page Any ideas?