I have two library / projects under one project and want to use project 1 standalone components into project 2

31 views Asked by At

I have two library / projects under one project and want to use project 1 standalone components into project 2 module.

Below is the structure of may project.

Project --> Project 1 --> src --> lib --> components all the components are standalone and at same level index.ts file which exports all the component's. and public-api.ts also contain index.ts as export for root level.

For project 2 Project --> Project 2--> src --> lib --> components -> exampleComponent --> [multiple component] and same level the demo.module.ts as well which exports all the components.

I want to import my project 1 component into demo.module.ts of project 2.

Both the project are in angular 13.

I have tried multiple ways :

  1. Directly import the standalone component into the demo.module.ts but got
**error : 61        ExampleComponent,
           ~~~~~~~~~~~~~~~
    Unknown reference.**
  1. From project 1 make the standalone component to normal component and export them by making a module.ts file and use that to import in demo.module.ts.

  2. Creating share module at project root level which import both the module and can communicate but did not worked.

0

There are 0 answers