This new @NgModule crap has got me stumped. Before, I was able to cleanly specify a @Component
's directive dependencies via the directives: []
attribute of the @Component
meta object. So:
@Component({ /* ... */ })
export class Cmp1 {}
@Component({ /* ... */ })
export class Cmp2 {}
@Component({
/* ... */
directives: [Cmp1]
})
export class Cmp3 {}
@Component({
/* ... */
directives: [Cmp2, Cmp3]
})
export class Cmp4 {}
Now, under the guise of "convenience" it appears I have to now declare an @NgModule with all four of these components in a single array, like this:
@NgModule({
declarations: [Cmp1, Cmp2, Cmp3, Cmp4],
exports: [Cmp4],
imports: [Cmp1, Cmp2, Cmp3, Cmp4]
})
export class YetAnotherWrapperClass {}
Doesn't that obscure the true dependency graph of my components? If I do that, how do I know that it is actually Cmp3 that depends on Cmp1? Oh sure, I get to omit some import statements here and there, but it seems like the cost is losing explicit dependencies for each component.
I read through the migration guide and the angular modules guide, but I feel as if I fundamentally disagree with the @NgModule design decision. Am I missing something?