Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Select another tab with parameters

$
0
0

@IAmos wrote:

Hi

I have tab 1 with a list of items. I have tab 2 with 2 modes, a list of purchases of all items and a list of purchases of a specific item. The default view of tab 2 is the purchases of all the items, when clicking an item, the list changes to show the purchases of the clicked item. That works as expected. Now I want to call tab 2 from tab 1 with a parameter so it will show the purchases of the selected item (sent as a parameter), I did the following in page 1

gotoPage2(info: string){
    this.navCtrl.push(InfoPage, { withInfo: info });    
}

and the following in page 2

ngAfterViewInit() {
    if (this.navParams.get('withInfo') != null) {
      this.displayOnlyThisItem(this.navParams.get('withInfo'));
    }

}

This is working great except for the fact that tab 2 is not highlighted. I read that for that I should do the following: this.navCtrl.parent.select(3); and that works but I can’t pass it parameters

At first I thought I could live with option 1 above but then I realized that when showing tab 2 with a parameter (tab is not highlighted, showing one item) and then manually select tab 2 (tab is highlighted, showing all items) and then manually select tab 1, I again see tab 2 content (purchases of selected item) as if the app goes “back” and not really selecting tab 1.

How can I simulate the click and highlight of tab 2 with a parameter?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>