Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular2 use component of nested imported module

is it possible to have the following strucure?

app.component.js

@Component({
    template: '<nav-context></nav-context>'
class AppComponent

app.module.js

@NgModule({
    imports: [CoreModule]
    boostrap: [AppComponent]

core.module.js

@NgModule({
    imports: [NavModule]
class CoreModule

nav.module.js

@NgModule({
    declarations: [NavContextComponent]
    exports: [NavContextComponent]
class NavModule

nav-context.component.js

@Component({
    selector: 'nav-context'
class NavContextComponent

So far I get 'nav-context' is not a known element

like image 484
select Avatar asked Sep 13 '16 10:09

select


1 Answers

I think you need to also export the module if you want it to be provided to importers

@NgModule({
    imports: [NavModule]
    exports: [NavModule]
like image 80
Günter Zöchbauer Avatar answered Oct 18 '22 12:10

Günter Zöchbauer