isaacplmann / ngx-contextmenu

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

Angular 9 - Can't resolve all parameters for ContextMenuContentComponent #200

Open silkcom opened 4 years ago

silkcom commented 4 years ago

Describe the bug After upgrading to Angular 9 it seems like the @angular/core - Renderer function is not being passed into ContextMenuContentComponent somehow

I'm getting the error: Error: Can't resolve all parameters for ContextMenuContentComponent: ([object Object], [object Object], [object Object], ?).

hasanenalbana commented 4 years ago

In my case I am not getting any error related to ngx-contextmenu, instead, it shows empty menu on right-click, it is like empty 2px height div.

update1: The ngx-contextmenu seems to work in Angular 9.1.0 just fine. However, there seem to be some changes, in angular8 my code used to work just fine this way:

<context-menu *ngIf="tableConfig?.hasInlineActions===true">
  <div *ngFor="let action of tableConfig?.actions" >
        <ng-template contextMenuItem>
            <i *ngIf="action.icon" class="{{action.icon}}"></i>&nbsp;
            {{action.label}}
        </ng-template>
    </div>
</context-menu>

However, when upgraded to Angular9, the menu works only if I remove the DIV inside the context-menu, but this way I will lose the ability to iterate over an array or menu items!

update2: All good, ngx-contextmenu is working just fine on my Angular 9.1.0 project. I am using the latest version 5.4.0. My code looks like this now:

<context-menu *ngIf="tableConfig?.hasInlineActions===true">
  <ng-template *ngFor="let action of tableConfig?.actions" contextMenuItem (execute)="fire_context_action($event.item,action.name)" [visible]="action.inline && action.inline==true && ( action.acl && auth.has(action.acl) )">
      <i *ngIf="action.icon" class="{{action.icon}}"></i>&nbsp;
      {{action.label}}
  </ng-template>
</context-menu>
brijeshpant83 commented 4 years ago

facing same issue as @silkcom facing here is my config in angular 9.x "<li *ngFor="let item of items" [contextMenu]="basicMenu" [contextMenuSubject]="item">{{item?.name}}"