Warning: Use of undefined constant cevhershare_init - assumed 'cevhershare_init' (this will throw an Error in a future version of PHP) in /home/customer/www/jaspreetchahal.org/public_html/wp-content/plugins/cevhershare/cevhershare.php on line 233

Warning: Use of undefined constant cevhershare_header - assumed 'cevhershare_header' (this will throw an Error in a future version of PHP) in /home/customer/www/jaspreetchahal.org/public_html/wp-content/plugins/cevhershare/cevhershare.php on line 234

Warning: Cannot modify header information - headers already sent by (output started at /home/customer/www/jaspreetchahal.org/public_html/wp-content/plugins/cevhershare/cevhershare.php:233) in /home/customer/www/jaspreetchahal.org/public_html/wp-content/plugins/wp-greet-box/includes/wp-greet-box.class.php on line 493

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/customer/www/jaspreetchahal.org/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340
AngularJS and Ionic Archives - Jaspreet Chahal
Warning: preg_match_all(): Compilation failed: invalid range in character class at offset 7 in /home/customer/www/jaspreetchahal.org/public_html/wp-content/plugins/wordpress-notification-bar/inc/lib/seed-wnb-lessc.inc.php on line 1445

Ionic 2+ How to access parent navController

There could potentially be scenarios when you will have something like this [crayon-5e8c6e9964356775875044/] Each of ion-nav components have their own NavController, when you try to push or pop a view, depending on the inheritance level of your ion-nav , the view will be pushed or popped from the view stack of the related NavController Now there could be instances where you want to say set a Root page that would go under the parent Nav, This is how you would do it Firstly we will import the App and NavController components in the Child component as shown below, both of these can be found under ionic-angular module import { App, NavController } from 'ionic-angular'; Let's say you want to make SettingsPage as your Application root, You will first import it like this, [crayon-5e8c6e9964365104922140/] then make sure that this exists in entryComponents and declarations arrays under app.module.ts file as shown below (if ) [crayon-5e8c6e9964368899133439/] now we will provide the instance of App to your child component as shown below [crayon-5e8c6e996436a589742833/] Its now easy to get hold of NavController for the parent and set our SettingsPage as root, as shown below [crayon-5e8c6e996436c291992678/] OR You can also pass on SettingsPage as a string value in case you want to stick with Lazy loading (give that the page has its own IonicPageModule), this method does not need you to add entries in entryComponents and declarations arrays under app.module.ts [crayon-5e8c6e9964375216542052/] This should work There could potentially be another way, feel free to leave another method if you know any or if you find any issues with above approach. Hope this helps Cheers   … [Read more...]