Hi, straight to the point:

I use Angular-cli v. 1.0.0

There is a main module:

@NgModule({ imports: [ CommonModule, BrowserModule, DashboardModule, ..... another modules ..... ], declarations: [ AppComponent, HeaderComponent, BeautyPriceDirective ], bootstrap: [AppComponent] }) export class AppModule {} 

It connects BeautyPriceDirective, the usual such attribute directive.

And there is a second module that is imported into the main (AppModule):

 @NgModule({ imports: [ CommonModule, BrowserModule ], declarations: [ DashboardComponent, DashboardTilesComponent, ], }) export class DashboardModule { } 

The problem is that the directive does not work in the DashboardComponent component and in all the nested ones, but it works quietly for itself in the HeaderComponent, which is declared in the first module.

Also, if you declare DashboardComponent in the first module, then the directive in it works perfectly.

Most likely there is some not at all tricky way to "forward" directives and other data into the imported module ... or is it still not, and you need to make a huge list of components like this?

PS when I try to place a known directive in an imported module - Angular swears that this announcement is already indicated in two modules.

  • what version of angular? Try adding the exports: [BeautyPriceDirective] section in AppModule exports: [BeautyPriceDirective] - Grundy
  • ideally make a minimal reproducible example. On plnkr.co - Grundy
  • @Grundy, npm angular --v tells me that I am using the version 3.10.8 of exports: alas, it did not help, but tried ( - Webiart
  • is he saying something else, the angular has the first digit in version 2. - Grundy
  • @Grundy, yes, I also thought that it would be very strange if it were true. But something I can not find the version, just not lower than 2.1.0 (from package.json). I tried to look at node_modules, in the files of the most angular, but there is also empty. on plnkr, the latest available version is 2, it still supports such things as directives: [] and all sorts of Template decorators that seem to be vipileny - Webiart

0