5

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

2
  • Can you please structure the code in a more organized way? one code section per class Commented Sep 13, 2016 at 10:36
  • I restructured my code :) Commented Sep 13, 2016 at 10:41

1 Answer 1

8

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

@NgModule({
    imports: [NavModule]
    exports: [NavModule]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.