What is the difference between valueChanges and statusChanges, and how do you use them safely?

Angular forms · Freshers and experienced

Model answer

valueChanges is an Observable that emits whenever a control's value changes. statusChanges emits when validity status changes. They are useful for reacting to input, such as calling a search API as the user types.

Add debounceTime and distinctUntilChanged to avoid too many requests, and unsubscribe when the component is destroyed (takeUntilDestroyed is a convenient way). Forget this and you get leaks and duplicate calls.

Learn this topic

Angular Tutorial: Beginner to Advanced .

Sign in to add your own answer.

More questions