Menu items at multiple levels

UI Components for Angular
Post Reply
ekprimeng
Posts: 5
Joined: 16 Aug 2023, 22:10

16 Aug 2023, 22:15

Is it possible to have clickable menu items at multiple levels in a context menu?

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),
            }
        ),
      });
    }
What I want is to always have a clickable Edit menu at the top level and then possibly the Modes submenu with clickable items within it when necessary.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 5 guests