Description
I am getting an error trying to use jquery-contextMenu (v2.7.0) with Angular 6. It was installed with npm install --save jquery-contextmenu.
In pure Javascript same code is working fine, within Angular I get the following error in Chrome. Any advice would be appreciated. Thanks
core.js:14576 ERROR TypeError: node.contextMenu is not a function
at HTMLDocument. (app.component.ts:595)
at mightThrow (jquery.js:3534)
at process (jquery.js:3602)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:16126)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
at push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (zone.js:496)
at ZoneTask.invoke (zone.js:485)
at timer (zone.js:2054)
The code is very simple, something like this:
$(function(){
let channelContainer = '#channel';
let node : any = $(channelContainer);
node.contextMenu({
selector: 'div',
items: {
"item1": {
name: "Delete",
callback: function() {
...
}
},
"sep1": "---------",
"cancel": {
name: "Cancel",
callback: function() {
}
}
}
});
});