Set the default navOptions for Navigation Controller?


#1

Dear all,

Is it possible to setup a default navOptions for the Navigation Controller?

Why I ask this is, I know that the individual function of a navController can apply the navOptions, e.g.:
this.navController.push (NewPage, null, navOptions);

However, I cannot find out how to apply the navOptions for the Back Button after I pushed a page, and it will be great if I can even control all the navigation actions to use the same navOptions! Thanks!

Best Regards,
Vincent Tam


#2

I seems found it out by myself, I just create a ViewController in the page’s constructor function
(public viewCtrl: ViewController)

Then I setup the ViewController’s setLeavingOpts before I push the page with Navigation Controller:

this.viewCtrl.setLeavingOpts(navOpts);
this.navCtrl.push(Page2, {
item: item
},navOpts);