There are two variables depending on each other (color and pictures). Depending means following: When the variable color has the value of'BLUE' I want to filter all the pictues which have the color blue and so on. Variable pictures is a subject with a service/backend call:
this.colorSubject.subscribe((color) => {
subject.switchMap((searchTerm: string) => serviceCall(searchTerm, color) ).subsribe(...)
});
For that I need to listen for the change of the color variable and then calling the above line of code. But this causes multiple calls of the service.
Any ideas how to handle this issue?