0

I install this module for my Angular project by ng add command. It imports the module in the app.module file. Also, I use lazy loading modules and routes in my project. I need this external module in one of my routes. I don't want to import it in app.module.

But when I remove the import in app.module, I get the following errors:

core.js:15714 ERROR Error: Uncaught (in promise): Error: 
StaticInjectorError(AppBrowserModule)[InjectionToken nz-i18n]:
...

Am I wrong? Where should I import such modules? If it's lazy loading, it's not reasonable to import it in the app.module file.

Vahid Najafi
  • 4,654
  • 11
  • 43
  • 88

1 Answers1

0

Try to create shared.module.ts and import all your components / modules you want in your app (common) into this one and then import this into app.module.ts

  • Thanks for your answer. But I think you didn't get me. I've already created a shared module. It works fine when I want to access a module in all pages. In my question, I want to access an external module only in a lazy loaded module or route. – Vahid Najafi Apr 04 '19 at 17:21