udaya
udaya

Reputation: 9788

How to reuse a component across different application in Angular

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

Upvotes: 3

Views: 1317

Answers (2)

Adrita Sharma
Adrita Sharma

Reputation: 22203

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

Upvotes: 2

Related Questions