Search code examples
angularsystemjs

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.


Solution

  • 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