Попробуйте этот пример
В тс
import {Component} из '@ angular / core';
@Component({
selector: 'button-overview-example',
templateUrl: 'button-overview-example.html',
styleUrls: ['button-overview-example.css'],
})
export class ButtonOverviewExample {
currentUserRole : string = "Admin"
roles = [{"url":"/admin/companies","id":"Admin","bid":"A","title":"Companies"},{"url":"/companies","id":"Employer","bid":"E","title":"Employee"}]
}
В HTML
<div *ngFor="let role of roles">
<a
[href]="role.url"
mat-button
*ngIf="currentUserRole == role.id"
>
<mat-icon
[matBadge]="role.bid"
>business</mat-icon
>
{{role.title}}</a
>
</div>