ngx-contextmenu icon indicating copy to clipboard operation
ngx-contextmenu copied to clipboard

Allow triggering the context menu before ContextMenuItems have been loaded

Open isaacplmann opened this issue 8 years ago • 1 comments

It would be nice if the context menu gracefully handled people trying to trigger it before the ContextMenuItems had been found by the ContextMenuComponent.

We could create a Subject that emits the menuItems in the ngAfterContentInit hook of the component and use that in the onMenuEvent method to only trigger the context menu after the menuItems are loaded.

Originally reported by @achyutgp in issue #6.

isaacplmann avatar Nov 02 '17 13:11 isaacplmann

Yes that's a nice idea. Currently I'm using it like this:

  1. Retrieve contextMenuActions anyhow, async way maybe.
  2. Call contextMenuService.show.next.

Would be nice to show a menu with a scroller and than show items.

Though there's one question here. For some reason currently I need to call setTimeout(() => contextMenuService.show.next) otherwise execute actions don't work.

sherlock1982 avatar Mar 12 '18 16:03 sherlock1982