Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 - make imported modules accessible in child modules

Is it possible to make modules, imported in a root module accessible in child modules?

For example, now I have root module with imported FormsModule & ReactiveFormsModule & custom RoutingModule:

// ...
@NgModule({
    // ...
    imports: [
        BrowserModule,
        FormsModule,
        ReactiveFormsModule,
        RoutingModule,
    ],
    // ...
})

But the problem is that in child RoutingModule components ReactiveFormsModule declarations are not accessible, so that I also need to import it there (in RoutingModule imports).

Is it a way to make all imported modules accessible for each other from top to bottom of import statement?

like image 777
pandomic Avatar asked Sep 02 '25 02:09

pandomic


1 Answers

Just like you imported export them from this module to be available for the child modules

exports: [
        BrowserModule,
        FormsModule,
        ReactiveFormsModule,
        RoutingModule,
    ],
like image 122
Aravind Avatar answered Sep 06 '25 08:09

Aravind