Is the ModalController Documentation incorrect?

The ModalController doc says that the modal presents itself in the root nav stack, but when I invoke the instance method getRootNav() for App, I do not get a Nav with the modal in it. I do however see it in a different Nav when I run getActiveNavContainers() for App.

No, this is the exactly behaviour we expect, because modal should be over all the elements, and if you place it at the root level it will make easier to control and to prevent problems with scopes and zones.

So how come getRootNav() does not have the Modal view in it? It seems that getRootNav() returns me the Nav stack that is underneath the modal. But the doc clearly says that the modal presents itself in the root Nav Stack.

There’s a difference between an Overlay and a Page. A modal is an Overlay. The Overlay is added to the root nav, and you can dismiss it by popping the root nav, but if you want to manipulate an Overlay, use the ViewController.

Because rootNav is the Ionic-Nav component, it only take care of whats is inside this navigation. Modals are no included in ionic nav.

Thanks for the info!

1 Like