Hi all… need some help !!!
I am still confuse how to pass rootParams to TabsPage…
my flow are like this…
When user login and success -> get user data -> go to user Tab Page ( there are 3 user Tab page ) and I don’t want any back navigation because all tab page have side menu.
I am able to get params data from Tab Parent but get null data in Tab child page.
Already saw @adam commit about feat (tabs) pass params to tabs but it’s hard for me to understand how to use it because i am still learning.
my login.js
doLogin() {
this.userService.userLogin(this.email, this.password)
.subscribe(
data => {
this.user = data;
console.log('Account Login with Success', this.user);
this.nav.setRoot(UserPage, this.user);
},
error => this.errorMessage = <any>error);
} // end of doLogin()
my tab.js
export class UserPage {
constructor(private params: NavParams) {
// this tells the tabs component which Pages
// should be each tab's root Page
this.tab1Root = UserProfilePage;
this.tab1Params = params;
this.tab2Root = UserFriendPage;
this.tab3Root = UserActivityPage;
console.log('params from login', this.tab1Params); // has data
}
my tab.html
`<ion-tabs>
<ion-tab [root]="tab1Root" [rootParams]="tab1Params" tabTitle="Profile" tabIcon="person"></ion-tab>
<ion-tab [root]="tab2Root" tabTitle="Friends" tabIcon="contacts"></ion-tab>
<ion-tab [root]="tab3Root" tabTitle="Activity" tabIcon="stats"></ion-tab>
</ion-tabs>`
my tab1Root.js
` export class UserProfilePage {
constructor(params: NavParams){
this.tab1Params = params;
console.log('params from UserProfilePage', this.tab1Params); // there is no data
}
}`
Thanks in advance for ur kindly help.