How to use nav.select() to pass in some data?

In this thread, Programatically change active tab on Ionic, two ways to programmatically change the active tab using select() emerged.

The solutions assumes the following scenario. You have 3 children pages, and one tabs page to house your children. Your current navigation is in one of the child, and you want to go to another child programmatically.

The solutions posted on the thread, which I confirmed working for at least one of them are:

  1. this.nav.parent.select(tabIndex); , with tabIndex being a number, eg 2 if currently on tab 0 or 1.
  2. this.app.getRootNav().getActiveChildNav().select(tabIndex);

I’d like to know if someone knows how to use select() and pass in some params with it?
I’ve tried this.nav.parent.select(tabIndex, {"key":"value"}); on the current tab, and on the tab that I navigate to, use NavParams to try to this.navParams.get('key'), but this does not work.

Edit: I ended up using a provider to set a value before calling select(), and on the second tab that I navigate to, I use a getter using a Observable on page enter to listen to that provider’s value. It’s very heavy handed, and I did not want to use Local Storage because I feel that that’s persistent data and I don’t need it to persist.

Select itself only takes a tab index and a NavOptions object (do you want to animate the transition etc.) In theory though what you want can be done, maybe. The Ionic source code gives an example that isn’t in the documentation, using rootParams. However, there’s an open issue on Github about rootParams not working. The source code and comments about using rootParams are in the Ionic tab.ts file, if you want to take a look

It’s not clear to me how well supported this is. If I had to do what you’re asking about, I’d use some form of local storage, because the pure Ionic solution may or may not work consistently.

I played around with this myself as I wanted to turn off the tabs completely when the user logs out.

There is no decent way to do that.