What is the best Practice to share code between angular 2 Projects?

Asked

Viewed 81 times

1

What is the best Practice to share code between angular 2 Projects? How can I share Components between Projects?

Below Dashboard example should be use Components of the eye project, and Nose project.

In this case, using this Seed https://github.com/mgechev/angular2-seed. I run three Commands Below to see all aplications, but, I need copy Nose source and eye source to Dashboard project to share componets

npm run serve.dev -- --client eye
npm run serve.dev -- --client nose
npm run serve.dev -- --client dashboard

I miss the hot Reload, because if Modify eye.Component or Nose.Component need copy this Components to Dashboard project

src
├── eye
│   ├── app
│   │   ├── components
│   │   │   ├── eye.component.html
│   │   │   ├── eye.component.ts
│   │   │   ├── eye.component.css
├── nose
│   ├── app
│   │   ├── components
│   │   │   ├── nose.component.html
│   │   │   ├── nose.component.ts
│   │   │   ├── nose.component.css
├── dashboard
│   ├── app
│   │   ├── components
│   │   │   ├── dashboard.component.html
│   │   │   ├── dashboard.component.ts
│   │   │   ├── dashboard.component.css

Other example, to ilustrate

In the Structure Below, commonaplication need share eye.Component and Nose.Component with bodyapplition and dashboardaplication.

src
├── commonaplication
│ ├── app
│ │ ├── components
│ │ │ ├── eye.component.ts
│ │ │ ├── nose.component.ts
├── bodyaplication
│ ├── app
│ │ ├── components
│ │ │ ├── head.component.ts
├── dashboardaplication
│ ├── app
│ │ ├── components
│ │ │ ├── dashboard.component.ts
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.