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

Having a hard time understanding the navigation with tabs

$
0
0

@turgodi wrote:

Hello,

I have my application with 4 tabs, and i want to check if the user is logged in everytime a user switches tab, so i'm using the 'ionViewCanEnter' lifecycle hook. But it seems like it only works one the first time the user gets on the tab.
Please don't mind the design, i'm just experimenting. The login tab is temporary.

Here's a scenario :
1. User arrives on Planets tab -> ionViewCanEnter fired
2. User clicks Research tab -> ionViewCanEnter fired
3. User clicks Planets tab to get back -> ionViewCanEnter is NOT fired
4. user clicks Research tab -> ionViewCanEnter is NOT fired

Are the tabs still active in the background when a tab is switched to another ?
I would like to reload the whole tab (Page) everytime because i have to check if the token (jwt) is still valid (not expired) and i have to reload the data from the back-end each time.

Thanks.

Here's the code i'm using for the tabs :

HTML

<ion-tab [root]="tab1Root" tabTitle="Planètes" [rootParams]="params" tabIcon="ios-planet-outline"></ion-tab>
<ion-tab [root]="tab2Root" tabTitle="Recherches" [rootParams]="params" tabIcon="ios-stats-outline"></ion-tab>
<ion-tab [root]="tab3Root" tabTitle="Galaxie" [rootParams]="params" tabIcon="ios-ionic-outline"></ion-tab>
<ion-tab [root]="tab4Root" tabTitle="Login" [rootParams]="params" tabIcon="ios-ionic-user"></ion-tab>

TS

tab1Root = PlanetsPage;
tab2Root = ResearchPage;
tab3Root = GalaxyPage;
tab4Root = LoginPage;

Posts: 22

Participants: 4

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>