isaacplmann / ngx-contextmenu

An Angular component to show a context menu on an arbitrary component
MIT License
248 stars 91 forks source link

ngx-contextmenu In a Different Component #114

Open kunalDel9 opened 6 years ago

kunalDel9 commented 6 years ago

Can i get code reference when my context menu option are in different component. I am unable to set super() in Constructor call. so i need some code reference. please help asap.

isaacplmann commented 6 years ago

I'm not sure what you're asking for. You can browse through all the code.

kunalDel9 commented 6 years ago

I want code sample where you implemented context menu option in different component.

Context menu tag is not on same component. It is in different component.

On Tue, 22 May 2018, 6:29 pm Isaac Mann, notifications@github.com wrote:

I'm not sure what you're asking for. You can browse through all the code https://github.com/isaacplmann/ngx-contextmenu.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/isaacplmann/ngx-contextmenu/issues/114#issuecomment-390980492, or mute the thread https://github.com/notifications/unsubscribe-auth/AgKFOJMlp5nTdoORSmoCqmkUiokMP4i5ks5t1AulgaJpZM4UIl7n .

kunalDel9 commented 6 years ago

assetthumnailview.zip

kunalDel9 commented 6 years ago

Please View these file.. I have a component assetthumnailview which has UL LI. it click on LI context Menu invoked. For Context Menu I have different Component which extends ContextMenuComponent Class. But i am unable to Open Context Menu. That's why i need Some Code sample where Contextmenu is in different Component.

isaacplmann commented 6 years ago

You don't need to have asset card context menu extend ContextMenuComponent. Just have it include the <context-menu> element in the template like you already are.

Then, you need to make sure that the <app-assetcardcontextmenu> component is rendered somewhere on the page and that the ContextMenuModule.forRoot() is imported in a module that is not lazy loaded.

kunalDel9 commented 6 years ago

Hii isaac,

I have worked on this work around still unable to fix my problem. I have made a component which has input array data to create option.

Now other components pass there option to create its context menu. Even on same component to different context menu required. Like clicking on UL area will open context menu and clicking on LI will open different context menu. Please provide some sample code. I have tried your suggestion. On Wed, 23 May 2018, 7:16 pm Isaac Mann, wrote: > You don't need to asset card context menu extend ContextMenuComponent. > Just have it include the element in the template. > > Then, you need to make sure that the component > is rendered somewhere on the page and that the ContextMenuModule.forRoot() > is imported in a module that is not lazy loaded. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > , > or mute the thread > > . >