angular 2 RC5 ngModules vs. barrels

655 Views Asked by At

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?

1

There are 1 best solutions below

2
On BEST ANSWER

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.