Load default page for LazyLoading IonicPage()


#1

We have a two level navigation, with the app navigation which contains two pages, one for the login and one for the main-content pages.

            ----> LOGIN (login)
APP-NAV ----                          ------> Page1
            ----> MAIN-CONTENT (main) ------> Page2
                                      ------> Page3

So we have the following possibile “urls”

http://localhost:8100/#/login
http://localhost:8100/#/main/page1
http://localhost:8100/#/main/page2
http://localhost:8100/#/main/page3

If we load MAIN-CONTENT then we have to load DEFAULT sub page which in this case is Page1, we can do this simple by doing in the constructor something like this:
this.nav.setRoot('Page1', {});

The problem is, if we load directly this url http://localhost:8100/#/main/page2 now the page load MainPage which redirects first to Page1 and then the ionic framework loads Page2.
If we load directly http://localhost:8100/#/main/page1 the Page1 will be loaded two times!

So this is a really behaviour and I thinke for now there is no way to handle default sub pages or also we can not check in the constructor which is the REAL url/segment. If we have at least the possibility to check load the requested url, we can check if there is the subpage url and do not load the default page in the constructor

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

global packages:
    @ionic/cli-utils : 1.2.0
    Cordova CLI      : 7.0.1 
    Ionic CLI        : 3.2.0

local packages:
    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.2.0
    @ionic/cli-plugin-ionic-angular : 1.2.0
    Cordova Platforms               : android 6.2.3
    Ionic Framework                 : ionic-angular 3.0.1

System:
    Node       : v7.10.0
    OS         : Linux 4.10
    Xcode      : not installed
    ios-deploy : not installed