Skip to content

How can I share an Angular 2 component between multiple Angular 2 projects?

Ideally, I’d like to create a stand-alone Angular 2 component (with tests) and then re-use it between two or three different Angular 2 sites. What are the good ways to achieve this? And a bonus question – do any 3rd party Angular 2 components exist?





You can create an angular2 component library (with tests) and then use it in any number of projects

Then you can publish it on npm for public use. If you want to keep it private, you can read this

Yes, many 3rd party angular2 components exist. Here are a few from valor-software

If you don’t want to publish your library and still use it, you can create a mono repo architecture. There is a tool by ex-googlers called nx You can create a library using it and can use it in your project

Yeoman Generator for angular library

User contributions licensed under: CC BY-SA
6 People found this is helpful