Closed morizmartiner closed 3 years ago
Is ContextMenuModule.forRoot()
being imported in your AppModule
? If you have it imported in different lazy loaded modules, there will be multiple copies of the ContextMenuService
- which would cause the behavior you're describing.
Put a console.log
in your onContextMenu
method to make sure you're actually getting that far.
If those ideas don't help, I'll need to see more of your code.
I created a custom context menu component in a different file (CalendarContextMenuComponent
). That component extends your ContextMenuComponent
. Is this the correct way of using a custom made context menu?
In the onContextMenu
function the console.log
statement is logged to console correctly which confirms the function is indeed called. The context menu doesn't appear though.
How do I need to change the code to make my custom menu show up in this function?
Thanks for your help.
@Input() contextMenu: CalendarContextMenuComponent;
public onContextMenu($event: MouseEvent, item: any): void {
console.log("right click");
this.contextMenuService.show.next({
contextMenu: this.contextMenu,
event: $event,
item: item,
});
$event.preventDefault();
$event.stopPropagation();
}
what is this.contextMenu
when onContextMenu
is called? Is your CalendarContextMenuComponent
in the template of a component that is actually rendered on the screen when the you call this.contextMenuService.show.next
?
I need Code sample if problem is solved. i am implementing same and facing issue. Code written in CalendarContextMenuComponent.
I haven't found a solution for this issue. I've started creating my context menu without a library.
Hi,
I would like to move my existing context-menu to a separate component, but I can't figure out how to do it. I have tried to use the code provided in the readme (https://github.com/isaacplmann/ngx-contextmenu#context-menu-in-a-different-component), but nothing happens. Do I need to somehow subscribe my context-component to the ContextComponentService?
Thank you very much in advance!