I am having problem with import of module in angular 4. I have the following structure:
My app.module.ts
....
import { NavbarComponent } from './a2-components/navbar/navbar.component';
import { SidebarComponent } from './a2-components/sidebar/sidebar.component';
import {AdminModule} from './admin/admin.module';
@NgModule({
imports: [
...
AdminModule,
MaterialModule.forRoot(),
...
],
providers: [ ],
declarations : [
...
NavbarComponent,
SidebarComponent,
...
],
bootstrap: [ AppComponent ]
})
export class AppModule {
}
my admin.module
...
import { AdminComponent } from './admin.component';
import { HomeComponent } from './home/home.component';
import { AdminService } from './admin.service';
@NgModule({
imports: [ ... ],
declarations: [ AdminComponent, HomeComponent ],
providers:[ AdminComponent, AdminService ]
})
export class AdminModule {}
The app.module is a hierarchically larger module than admin.module. I'm importing the @angular/material, NavbarComponent and SidebarComponent, but I'm getting an error that the material, NavbarComponent and SidebarComponent are not being found in module admin.module.
Could someone give me a tip?

MaterialModuledoes is bundle up all component declarations ) in the scope ofAdminModuleor any other module. Just because you imported intoAppModulethe components are not automatically made available to otherNgModulefixtures. That is actually part of the point of "modules" in Angular in the first place. The only things you should expect to be global are "services". And for which the "material" project no longer exports.