My scenario involves 4 different observables being combined using "combineLatest". I am looking for a way to reset the value of observable 2 if observables 1, 3, or 4 emit a value. Is this possible? Thank you!
- Mat-table sort change event (Sort class)
- Mat-table change page event (PageEvent class)
- Custom observable (filter)
- Custom observable (other filter)
combineLatest($1, $2, $3, $4).subscribe(([a, b, c, d]) => CALL_HTTP_WITH_PARAMETERS(a, b, c, d))
Example (initial values)
$1 = name,asc
$2 = 2
$3 = bla bla
$4 = bla bla
CALL_HTTP_WITH_PARAMETERS("name,asc", 2, "bla bla", "bla bla")
Observable 1 emits the value "name,desc"
$1 = name,desc
$2 = 2 ==> should be reset to 1
$3 = bla bla
$4 = bla bla
CALL_HTTP_WITH_PARAMETERS("name,desc", 1, "bla bla", "bla bla")
Other scenario
Observable 3 emits the value "new value"
$1 = name,asc
$2 = 2 ==> should be reset to 1
$3 = new value
$4 = bla bla
CALL_HTTP_WITH_PARAMETERS("name,asc", 1, "new value", "bla bla")