In multiple projects, I have used a particular approach to pass data from one component to another. However, in my current project, I am facing an issue with passing data from a parent component (in AppModule) to a sidebar component (in CoreModule) upon dropdown change. The problem is that the subscribe method in the sidebar component, which acts as the child component in this scenario, does not trigger after the initial load. Could this be due to the components being in different modules, or is there another underlying issue?
For a live demo, click here.
Update:
This is how the modules are structured:
parent.module:
imports: [
SharedModule
],
providers: []
child.module:
imports: [
SharedModule
],
providers: []
shared.module:
providers: [
DataService
]
Even with the above setup, the issue persists. Moving DataService from shared.module to app.module resolves it, but I believe it should work fine within shared.module. Why is that?