form control on change code example
Example 1: angular 9 form value changes
this.reactiveForm.get("firstname").valueChanges.subscribe(selectedValue => {
console.log('firstname value changed')
console.log(selectedValue) //latest value of firstname
console.log(this.reactiveForm.get("firstname").value) //latest value of firstname
})
Example 2: get formcontrol value
this.loginForm = new FormGroup({
'email': new FormControl('', { validators: [Validators.required] })
});
// get like this
const { email } = this.loginForm.value;