4

In our project we are moving from Angular 2 RC4 to RC5.

Question is: with the introduction of ngModules, will the barrels (index files) become unnecessary? Or can you use both in parallel? how to use these 2 concepts?

Doek
  • 161
  • 9

1 Answers1

6

Barrels are to simplify TypeScript imports and are optional.
They aren't recommended anymore by the Angular2 team because they often cause issues with circular dependencies and similar.

@NgModule()s are Angular2 compilation units. @NgModule() and are an entirely different and unrelated concept and mandatory.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • Thanks for your reply. If Barrels aren't recommended anymore, what would be a good replacement of this concept? – Doek Sep 14 '16 at 09:31
  • Do you have a source for the "not recommended"?. I'd be interested in reading any discussion about this. – Paul Samsotha Sep 14 '16 at 09:40