How to reuse a component across different application in Angular

Viewed 207

I am having a component in Angular which i am using Across my Application.

Application A is one project which uses component 1.

Application B is another project that uses component 1

Here component 1 is the common component across two different application. How can i utilize the common component without copying the files. Can we install the component while we do npm install

Can npm install download the package of common component if we have the common component url in the package.json

2 Answers

Create a Custom Angular Library, have Component 1 in it, build and publish.

Your library will be ready to be installed via npm

Check Documentation

Related