Passing parameters between child tabs

Is there a way to pass data as parameters between child tabs when changing tabs programatically? Right now there’s a [rootParams] directive, but to my understanding, this is used to pass data from the parent tabs component to the child tab. But is there a way (without using providers) to pass parameters from childTabA to childTabB when changing tabs programmatically? (e.g this.navCtrl.parent.select(index, data) )

if you can’t do it directly maybe you can save the data in the parent and load it in the Child tab

Edited:
take a look at documentation NavControler

  pushPage(){
    // push another page on to the navigation stack
    // causing the nav controller to transition to the new page
    // optional data can also be passed to the pushed page.
    this.navCtrl.push(OtherPage, {
      id: "123",
      name: "Carl"
    });
  }

Is there a specific method to call on the parent that can store the data? All tabs are children of the parent tabs component. Using the push method to navigate to the second tab would make it a child of the first tab.

you could use a provider to store the Data, there is the storage component build in to save data and read it.

I was hoping to avoid that

Hi, I have the same need, although initially I am trying to call methods on the target page to achieve the same, see this plunker

I can’t explain why info or telling a page to hide one of its component is getting ignored.

I don’t want and can’t use .push() so Tabs .select() is what I am trying to do.

I even temporarily wrapped all the code with switching tabs and activating the player in the same method of the target page PlayersView.ts like so

   SelectTab(index: number) {

            this.AMSPlayerShow_ = true;
            this.YTPlayerShow_ = true;
            
        var Tabs: Tabs = this.NavController.parent;
        Tabs.select(index);   
    }

The tab select above works but the 1st two lines seems to have no effect.

Let me know if you have arrived at a solution and how because I remain dead in the water.
Thank you.

Don’t pass data directly between tabs. Create a more robust and generic solution: a data provider that every tab can read from and write to.

1 Like

I cannot still explain my question above even when I converted the field variables to props (set/get).
Why it does not work in this particular case while other props I used for toggling an element’s color work in other components still eludes me. Plunker - Ionic 2 - Can't Hide/Show content in another tab, why not?

Nonetheless, setting the prop in my existing GlobalService.ts is working.

I feel I am making progress thinking the new way or at least how this framework wants me to do things.
You can confirm or deny it here

Thank you.