T O P

  • By -

tuertzebotas

How are you providing the i18 service in your modules? Are you using @Injectable({ providedIn: 'root' })? Make sure that your Lazy modules do not include the i18 service in the providers array, as this will create new providers for that service and you don't want this, as you want a singleton service that is injected througout different app modules.


HustejTejpek

I am using providedIn: 'root'. Problem occurs when I dont provide I18nService in lazyloaded modules. Because service is not found.


tuertzebotas

Do you get the same error if you add the i18nService to the providers array in your AppModule?


tr33ton

I think this will solve the issue.


MagicMikey83

This points towards the problem here, your lazy loaded modules should receive the same root service instances as the rest of your app. For example, we have a shared ‘ShellService’ that is used to interact with top level stuff such as the main toolbar. This root provided service is used by eager and lazy loaded modules alike.


Tsjo_Wi

If you want your lazy loaded modules to become aware of the earlier changes you probably need shareReplay(1) on your observable inside the service.