Hello guys,
I need to change side menu pages dinamically, based on a variable value (who logged in the app).
Side menu had to change when user log in and when user log out…
Any tips?
This is my solution, but i don’t know if is good…
app.html
<ion-content>
<ion-list>
<div *ngIf="!authService.userIsLogged()">
<button ion-item *ngFor="let p of pages" (click)="openPage(p)">
{{p.title}}
</button>
</div>
<div *ngIf="authService.userIsLogged()">
<button ion-item *ngFor="let p of pages2" (click)="openPage(p)">
{{p.title}}
</button>
</div>
</ion-list>
</ion-content>
app.component.ts
this.pages = [
{ title: 'Profilo utente', component: Profile }
];
this.pages2 = [
{ title: 'Profilo utente', component: Profile },
{ title: 'Spese dipendenti', component: Spese },
{ title: 'Ordini clienti', component: Ordini }
];
Had 2 array of pages and show depends if user is logged or not…
Thx you.