I have a parent component and there are multiple child components and some components which are not direct descendants. There is one data which is taken as input from user in parent component.
Whenever the input value is changed in the parent component a function is called in service layer that sets the input value in a signal. this signal type variable is a class variable of that service class. The type of the class variable is WritableSignal<Number>
and it is set by using .set()
method when ever the input value is changed.
All the Signal related things are imported from @angular/core
.
All the child components and indirect descendants of the parent component have access to the service class and needs this signal type variable to do data fetching from backend.
I want whenever the value of the input variable changes and in turn it updates the signal value all the child components and other components that use this signal should run their function to do the data fetching again.
How can I do that.