using this example: enter link description here
everything works perfect - until I make the component a lazyload component, then the loader stops appearing. any idea what I'm missing here?
using this example: enter link description here
everything works perfect - until I make the component a lazyload component, then the loader stops appearing. any idea what I'm missing here?
Services are injectable, Angular creates a singleton for every provider(service) by default. Those singletons are passed to your components. When lazy loading a module, the module providers are re-created. So the components inside that module will get a new instance of the same service. This is why your subscription isn't triggered.
You should create a shared module witch can be used in lazy loaded modules. This answer can help you: https://stackoverflow.com/a/39672933/2640826
OK, found the problem, though I don't understand the reason.
I had a service in a common module, which was (the module) imported to the app module. for some reason these services do not work in a lazyload module, they do work however when I move them from the providers section in the common module to the providers section in the main app module.
will be glad to understand why this happens?