Issue
Should be quite a simple thing but I'm struggling to get my head around this. I just wish to prevent the observable continuing if the form is invalid. Any ideas?
this.subscription2 = this.myForm.valueChanges.pipe(
map(params => params['invalid']),
filter(invalid => !!invalid),
debounceTime(1000)).subscribe(x => {
//Logic here
});
Solution
If the form is invalid, you don't listen to a property of it, but to the form itself.
this.subscription2 = this.myForm.valueChanges.pipe(
filter(invalid => this.myForm.valid),
debounceTime(1000)).subscribe(x => {
//Logic here
});
Answered By - MGX
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.