I’m developing my first Ionic 2 app and its based on the tab starter app. I want to add a Login Screen before the tabs appear and be able to get back to that screen from a button. When the login screen re-appears I obviously don’t want it to be on any navigation stack i.e I want the app to effectively start again (before the tabs are opened). What’s the best way of doing this in Ionic 2 ?
I have the login screen appearing and after the user logs in I am displaying the tabs but I am not sure how to make that screen re-appear (with no navigation stack) ?
I’ve still not got this to work! If anyone wants to try creating an Ionic 2 app using the starter tabs template and adding a Login page that appears on launch and is then available later on (so it does not show a Back button and does not show the Tabs at the bottom) I’d love to see it so could see what I’m doing wrong. I’m sure this should be simple?
Trying to use modal (I have not done this before) and getting an error:
<ion-overlay></ion-overlay> required in root component template to use: modal
I have the overlay in my TabsPage which I set to the root before I try to open the modal - it doesn’t open though. The tabs page opens but I get the above error in the console.
Alexander, I can get that to work now but I am not sure how I can handle my actual login event. On my opening tab controller I get some data but I don’t want to retrieve that data until the user has logged in (via the modal). Do you know how I could react to that login event inside my tab controller and get the data only when login has occurred?
(or even just react to the modal closing as it is only closed when the user logs in) ?
One of options is to pass a function as a callback parameter to the login when you open modal and call it from login when user signed in (or canceled). That’s what I do.
There is also for sure should be some events in Ionic that handle view change but I am not too familiar with the framework yet.