Passing params in ionic sidemenu

519 Views Asked by At

When a user logins the ionic app, how do I pass the user ID to the pages listed in side menu.. Is there a possibility to send data through navParams?

1

There are 1 best solutions below

0
On

You have to store user ID in ionic storage when the user is login like this,

First, add Ionic storage in your app,

Then, use ionic storage in login component like this,

// set user ID
storage.set('userID', 'Your_user_ID');

Now, get the user ID in whichever component you want like this,

// get user ID
storage.get('userID').then((val) => {
  console.log('user ID', val);
});

Thank you.