I am trying to show a button (that opens a dialog component) either the current user is admin or not. The problem is that I cannot figure out how.
This is my html of my component:
<app-list [items]="items"
[page]="'1'"
[itemsPerPage]="'40'"
[hasPager]="false"
[hasFilters]="false"
[itemInfo]="itemInfo"
[loading]="loading"
(onAdd)="handleOnAdd($event)" -> this one renders the button
(onMenuItem)="handleOnMenuItem($event)">
</app-list>
In app-list component:
<app-add-button *ngIf="itemInfo.types"
[hasPager]="hasPager"
(onAction)="onAdd.emit($event)">
</app-add-button>
// .ts
@Output() onAdd = new EventEmitter();
What I wanted is to do something like this:
[loading]="loading"
*ngIf="loggedUser.coachAdmin"
(onAdd)="handleOnAdd($event)"
(onMenuItem)="handleOnMenuItem($event)">
To display the button(or at least making it functional) only if the user is a admin. There is such a way? Or at least how to solve it?