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.
- 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.
- 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 login.page.ts 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 login.page.ts. In login.page.ts, upon successful login, I set the my app’s homepage (let’s say hom.page) as the RootPage.
So, in my log.page.ts, 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.