I'm Angular2 newbie and I have some difficulties with im(ex)porting modules.
According to official styleguide CoreModule is:
CoreModule - import once when the app starts and never import anywhere else.
Does this mean that all those exported stuff from Core module will be only available in the Module where it is imported only? There is no way to make those stuff available in some child module? I created dummy project just to test this behavior:
Dummy component:
@Component({
selector: 'dummy-component',
template: '<h4>Dummy component</h4>',
})
export class DummyComponent {}
Core module:
import { DummyComponent } from './dummy.component';
@NgModule({
declarations : [DummyComponent],
exports : [DummyComponent]
})
export class CoreModule {}
App module(root module):
@NgModule({
declarations: [AppComponent,],
imports: [BrowserModule, CoreModule, HomeModule, RoutingModule],
exports : [CoreModule],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Home module declares home component:
@Component({
selector: 'home-component',
template:
`
<h2>Home component</h2>
<dummy-component></dummy-component>
`
})
export class HomeComponent {}
When I try to run this code I got this error:
'dummy-component' is not a known element