Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

Passing tabs NavParams to tab

$
0
0

Yeah I think my approach is wrong. To give you some context I'm passing an id through to the TabsPage navParams to use to query an SQL table and display results on Tab1.

So this.params = params; = 1 on the TabsPage but then I'm not sure how to access it on the tab1 page. Essentially I need to do something like this.parent.params.

The only way I've been able to do it is to add it into the HTML:

<ion-navbar *navbar>
    <ion-title>Tabs Page</ion-title>
</ion-navbar>


<div id="paramid" style="display: none;">{{ id }}</div>
<ion-tabs>
    <ion-tab [root]="tab1Root" tabTitle="Tab 1"></ion-tab>
    <ion-tab [root]="tab2Root" tabTitle="Tab 2"></ion-tab>
    <ion-tab [root]="tab3Root" tabTitle="Tab 3"></ion-tab>
</ion-tabs>

then grab it out again in tab1:

this.id = document.getElementById('paramid').innerHTML;

But this seems a little messy.


Viewing all articles
Browse latest Browse all 228595

Trending Articles



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