shared module issues
See original GitHub issueI am using ngx-toastr in one of my angular 7 library project, it is been consumed by another host project. The host project works perfectly fine in dev version, but when i create production build(using ng build --prod) it gives me following error:
StaticInjectorError(Platform: core)[InjectionToken ToastConfig]:
NullInjectorError: No provider for InjectionToken ToastConfig!
Error: StaticInjectorError[InjectionToken ToastConfig]:
StaticInjectorError(Platform: core)[InjectionToken ToastConfig]:
NullInjectorError: No provider for InjectionToken ToastConfig!```
I am already importing **ToastrModule.forRoot()** in my library module, not sure why there's dual behavior for dev and prod environment?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top Results From Across the Web
What is the correct way to deal with shared modules? #543
In studio, go to Windows> preference and make sure you see this entry. If not then add it and restart studio. ... Open...
Read more >Error trying to use a shared module in Angular 9 make my ...
To avoid this problem you need to Add SharedModule as an import in all the FeatureModules where your components reside as declarations.
Read more >Sharing modules - Angular
Creating shared modules allows you to organize and streamline your code. You can put commonly used directives, pipes, and components into one module...
Read more >Eliminating Shared Module(s) - Medium
Online research points to a consensus that several Shared modules is now considered best practice, which I immediately took issue with back ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
there isn’t a way to import toastr from a shared module right now.
@RoRoche try importing ToastrModule.forRoot() instead ToastrModule in your shared modules.