Nav.present(alert) is not showing the alert


#1

I have a tabs ionic2 app. In one of the tab pages (a @Component) I create an Alert, the classic way, then inject (private nav: NavController) in the constructor - this always worked in the past, but it no longer does (not sure under which version the behavior broke though): no alert gets presented when this.nav.present(alert) is called.

The nav.present(alert) calls from anywhere on my page (this forum post discusses the same problem but only from within ionViewWillEnter()) does not present anything. There is no error reported, nothing reported. The alert just does not appear at all.

Has anybody seen their alerts not appearing on recent versions of Ionic2? I’m using beta.10.

Thanks!

UPDATE:
I cannot replicate the issue yet. Just taking the stalk ionic start tst tabs app and adding an alert works fine. My tabs are working in tandem with a Menu side menu, that must be the cause of NavController not injecting properly into the page… Adding an alert presented via NavController injection in the ionic-conference-app also works. Looking into this…

On further tests: this.nav.present(...) does not present anything when the app has a tab page and no <ion-nav> anywhere - i.e. we’re just relying on the Tabs to do our navs for us. As soon as you use <ion-nav> , then this.nav.present(...) works as expected. Is this the desired behavior? I thought that Tabs simply extends NavController, so it seems like you should be able to grab the current Tabs navigation controller and use it to present alerts and Popups, no?


#2

I guess looking at this forum’s thread #56654 - AlertController has not yet been implemented. It can solve the above problem it seems, from its documentation - can’t wait!

e.g. search for ‘AlertController’ here.

or the documentation for AlertController has already been written here.