Pythorogus
Pythorogus

Reputation: 395

Unexpected value 'undefined' imported by the module '...'

Got this error : (SystemJS) Unexpected value 'undefined' imported by the module 'DossierModule'

I've got 2 ngModules importing each other, is it possible this error came from that ? In that case : DossierModule import ContactModule, and ContactModule import DossierModule. When i remove import in ContactModule, it works, the same for DossierModule.

So 2 Modules can't import each other ?

Thank you.

Upvotes: 3

Views: 5014

Answers (2)

Engineer
Engineer

Reputation: 310

both module import in appmodule.ts file like here contact module are added, you will have to add DossierModule and ContactModule

@NgModule({
  imports:      [ BrowserModule, ContactModule, DossierModule ],
  declarations: [ AppComponent, HighlightDirective, TitleComponent ],
  providers:    [ UserService ],
  bootstrap:    [ AppComponent ],
})

Upvotes: 1

Riv
Riv

Reputation: 1859

Yes, they shouldn't import each other. If the 2 modules import each other, you would end up with a circular reference. From Angular Module FAQ:

Angular does not like modules with circular references so don't let Module 'A' import Module 'B' which imports Module 'A'.

More info: Angular2 Module FAQ

Upvotes: 5

Related Questions