I am using Angular 5 with Reactive forms and need to make use of the valueChanges in order to disable required validation dynamically
component class:
ex
My answer is just development of this one.
By adding distinctUntilChanged()
in the pipeline just before subscribe()
you avoid the "Maximum call stack size exceeded" because
distinctUntilChanged method only emit when the current value is different than the last.
The usage:
this.userForm.get('password')
.valueChanges.pipe(distinctUntilChanged())
.subscribe(val => {})
Documentation