I am trying to develop a contact form, I want user to enter phone number values between length 10-12.
Notably same validation is working on Message
Keep and just transform the int values to strings.
const phoneControl: FormControl = this.myForm.controls.phone;
// Do not forget to unsubscribe
phoneControl.valueChanges.subscribe(v => {
// When erasing the input field, cannot read toString() of null, can occur
phoneControl.setValue((v && v.toString()) || null, { emitEvent: false });
});