Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
148
rated 0 times [  150] [ 2]  / answers: 1 / hits: 24155  / 9 Years ago, fri, january 29, 2016, 12:00:00

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?


More From » angular

 Answers
56

UPDATE


OFFICIAL Angular CLI https://angular.io/guide/creating-libraries


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 https://docs.npmjs.com/creating-and-publishing-private-packages


Yes, many 3rd party angular2 components exist. Here are a few from valor-software https://github.com/valor-software/ng2-plans




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 https://nx.dev/. You can create a library using it and can use it in your project https://nx.dev/latest/angular/tutorial/08-create-libs




Yeoman Generator for angular library https://github.com/jvandemo/generator-angular2-library


[#63508] Wednesday, January 27, 2016, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
pranavrorys

Total Points: 466
Total Questions: 87
Total Answers: 115

Location: Barbados
Member since Sun, Nov 27, 2022
2 Years ago
pranavrorys questions
Fri, May 27, 22, 00:00, 2 Years ago
Thu, Oct 28, 21, 00:00, 3 Years ago
Sat, May 30, 20, 00:00, 4 Years ago
Fri, Dec 20, 19, 00:00, 5 Years ago
;