'ngx-contextmenu - this.overlay.position(...) connectedTo is not a function

I am using ngx-contextmenu 5.4.0 and recently upgraded angular version to 13.

After upgrade context menu was not visible and was throwing following error.

Overlay error

I tried changing version of @angular/cdk to 11.2.13 and it worked.

But I have some other features which requires @angular/cdk 13.1.1. I even tried another combination @angular/cdk 13.1.1 and ngx-contextmenu 6.0.0, but even that didn't work.

How do I go about?



Solution 1:[1]

For those who don't wanna read the github discussion: just remove the ngx-contextmenu and then add the @perfectmemory/ngx-contextmenu with npm, 7.0.0 for angular 13, and 6.0.0 for angular 12, it's the same but one user fixed the bug

but just in case, i'll leave you here the link to the issue discussion: https://github.com/isaacplmann/ngx-contextmenu/issues/242

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1