combineLatest with FormControl valueChanges event binding not emitting combineLatest with FormControl valueChanges event binding not emitting typescript typescript

combineLatest with FormControl valueChanges event binding not emitting


You probably want to have an initial value for both Observables. combineLatest will only emit if all Observables have emitted at least one value. Use the startWith operator to create this behaviour, like this:

combineLatest(    this.toppings.valueChanges.pipe(startWith("")),     this.toppings2.valueChanges.pipe(startWith("")))

Or, if you have initial values available, like suggested:

combineLatest(    this.toppings.valueChanges.pipe(startWith(this.toppings.value)),     this.toppings2.valueChanges.pipe(startWith(this.toppings2.value)))

Note, that this will emit once with the initial values. To supress this behaviour, you can use the skip(1) operator to ignore this initial notification.