Check out example codes for "angular formgroup mark as touched". It will help you in understanding the concepts better.

Code Example 1

// From Angular 8/9 you can simply use
this.formGroup.markAllAsTouched();


/**
 * For version older than Angular 8
 * Marks all controls in a form group as touched
 * @param formGroup - The form group to touch
 */
private markFormGroupTouched(formGroup: FormGroup) {
  (<any>Object).values(formGroup.controls).forEach(control => {
    control.markAsTouched();

    if (control.controls) {
      this.markFormGroupTouched(control);
    }
  });
}

Learn ReactJs, React Native from akashmittal.com