If I do something like below, the "Edit" renders clickable when someFlag is false ("Modes" not added) but is not clickable when it's true.
Code: Select all
this.menuOptions.push({
label: "Edit",
icon: "pi pi-fw pi-pencil",
command: () => this.edit(),
});
if (someFlag) {
this.menuOptions.push({
label: "Modes",
icon: "pi pi-fw pi-desktop",
items: this.inputs.modes.map(
mode =>
<MenuItem>{
label: mode.displayName,
icon: mode.displayIcon,
command: this.inputs.setMode(mode),
}
),
});
}