Passing User info to app.component for Side/App Menu

Hi All,

I am developing an app using Ionic 2 and have a couple of questions related to App Menu. Would highly appreciate if you can provide some help or guide in the right directions.

  1. What is the best way to implement the App Menu for an Ionic 2 app?

Right now, I have it in the app.html file in src/app directory.

  1. This question is related to how to pass user info with in the app and specifically to App Menu which resides in app.html file.

In my app.html/app.component.ts file the “RootPage” is set as LoginPage of the application. After the user enters credentials and click on “Login” button my call a Provider (let’s say auth-service.ts) which in turn calls REST API to authenticate the user. Once the user is successfully authenticated, I get the User object in my Provider (auth-service.ts) , which pass back to In, upon successful login, I set the my app’s homepage (let’s say as the RootPage.

So, in my, I have the User info object. I am going to use this User info or some of it’s information to pass back to the server to authorize the user while accessing different resources on the server.

Can somebody please help me in how I should implement passing of this User info object to my App Menu in app.html (or its TS file app.component.ts file)? I plan to display the logged in user’s name and email address at the top of the Side/App Menu and not sure how I get hold of that information after the user has successfully logged in.

Any help will be highly appreciated.


Use a shared service as described in part 4 of the Tour of Heroes.

Thanks @rapropos, will check that out.