How to reload pages bound to Tabs' root


#1

Hi, Ionic community.

I’m using Ionic2 beta 6, Is there any way to pass parameters from a Modal ( QueryFormPage )(which it’s called from Tab index 0) to a new Page SpeakerListPage that is bound to a Tab index 2, I’ve Tried different ways and it doesn’t work because the Page does not load again and it has a strange behavior after that (does not refresh), I need the Page SpeakerListPage to start loading again to use the parameter searchCriteria or call a Page’s method to refresh the list according to the parameter.

<ion-tabs #mytabs id="speakerTabs" [selectedIndex]="mySelectedIndex" preloadTabs="true">
  <ion-tab  tabTitle="Search" tabIcon="search" (select)="search()"></ion-tab>
  <ion-tab [root]="tab2Root" [rootParams]="searchCriteria" tabTitle="Deportistas" tabIcon="people"></ion-tab>
</ion-tabs>

Tab Page code.

    export class TabsPage {
    	 // set the root pages for each tab
        tab1Root: any = QueryFormPage;
        tab2Root: any = SpeakerListPage;
        mySelectedIndex: number;
        searchCriteria:{what?: string,where?:string,when?:Date};

`        constructor(private nav: Nav, navParams: NavParams, private app: IonicApp) {}`
         search() {
            //let tabs = this.app.getComponent('speakerTabs');
            //let tab = tabs.getByIndex(1);// get the second tab
           // tabs.select(1);

            let modal = Modal.create(QueryFormPage, {isModal: true, searchCriteria: this.searchCriteria}); // call modal search page
            this.nav.present(modal);
            modal.onDismiss(data => { // get the parameter
                  if (data) {
                   this.searchCriteria = data; //assign the parameter to the Page property that's bound to Tab index 2.
                  }
            });
        }
    }

Any help.

Thanks.