Ionic 4 menu with user role based authentication

Hi All,

Pls let me know how to manage different user types during login to ionic4

Please define “manage”, “different”, “user types”, and what “login to ionic4” means.

i want role wise show menu item in menu
eg

<ion-list>
      <ion-item>Menu Item</ion-item> this for user role admin
      <ion-item>Menu Item</ion-item>this for user role user
      <ion-item>Menu Item</ion-item>this for user role Agent
      <ion-item>Menu Item</ion-item>
      <ion-item>Menu Item</ion-item>
    </ion-list>

Use conditional *ngIf templating:

<ion-list>
      <ion-item *ngIf="userRoleIsAdmin">Menu Item</ion-item>
      <ion-item *ngIf="userRoleIsAgent">Menu Item</ion-item>
 </ion-list>
1 Like

In addition to @morphist’s excellent advice above, see here for a method of communicating logout/login changes across the app, including whereever this menu is hosted.

1 Like

This solution i have try already but my menu in app.component.html and i got the role by login it shows all menu item