Like that:
Code: Select all
<--The Json File-->
[
{
"label": "NAV.LogOut",
"icon" : "fas fa-sign-out-alt",
"command" : "this.logout()"
}
]
<--The Code-->
private userItems: MenuItem[];
this.loadAsset.getJSON('./assets/userMenuItems/userMenuItem.json').subscribe(res => {
if (res != null) { this.userItems = res; }
});
So the question is how can I pass dinamically the function "logout()" to the command parameter starting from a json string ?
Thanks for helping.