Closed celestale closed 6 years ago
Basically, you're trying to use your app A as a library for app B. The problem is that libraries need to be compiled in a different way in order to be consumed in another app.
Your specific problem is because there are two different ComponentPortal instances - one in app A and one in app B. They are compiled from the same code and could be used interchangeably, but Angular doesn't know that.
You might want to look into nx and see how they separate out shared code between multiple apps.
Hihi @isaacplmann , what I intend to explore was to export contextmenu in my "angular app A" for my "angular app B" to use. "angular app A" eventually will be used as a package inside the "angular app B".
In "angular app A" modules I had exported
ContextMenuModule
,ContextMenuComponent
In my "angular app B", I had imported
{ ContextMenuModule } from 'angular app A'
and alsoforRoot()
In "angular app B" AppComponent.ts, I use the basic contextmenu with imports from 'angular app A'
import { ContextMenuComponent } from 'angular app A';
@ViewChild(ContextMenuComponent) public basicMenu: ContextMenuComponent;
Somehow it compiles with no errors but whenever I tried to execute right-click it gets an error
I was hopping that this approach to export ngx-contextmenu to another angular app is the right way?