After further development I realize the above example is clearly not the intended approach. There is no way to link to the root page through a string name, so I have to pass the class name like previously. Also the
defaultHistory doesn’t work either, since it needs an array of strings and an empty string is discarded.
My solution, for anyone else in this situation, has several steps.
- Add your home page module to the app module
- In your other pages that will need the
defaultHistory to work,
b. in the templates
ion-navbar add a conditional home button.
c. in the component in
ngOnInit set the buttons conditional variable to be true if the
this.navController.length() <= 1.
d. when clicking the button the nav controller should push the home page with the
e. optionally make this a component to easily add in multiple pages.
This is a hack but it works. Can the Ionic team please fix this issue of not updating the url while the root view controller is active.