In Angular6, I want to implement dynamic permissions. My goal is to fetch a list of menu items from the database:
<li *ngFor="let op of optionList">
<!-- <fa-icon [icon]="op.icon"></fa-icon> -->
<label (click)='op.routeFunctionName()'>{{op.optionName}}</label>
</li>
The function op.routeFunctionName()
is intended for routing purposes.
This is an example of how routing should be implemented:
GoRoleManager() {
this.router.navigate(['panel/dashboard/'+this.userName+'/role']);
}
However, when clicking on the menu item, I encounter the following error:
ERROR TypeError: _v.context.$implicit.routeFunctionName is not a function
What could be causing this problem? How can it be resolved?