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

Code Example 1

import { FormGroup } from '@angular/forms';
public main_form : FormGroup;
this.form = new FormGroup({});

Code Example 2

loginForm.get('username').valid && loginForm.get('username').touched

Code Example 3

/* Answer to: "" */

  Reactive forms are built around observable streams, where form
  inputs and values are provided as streams of input values, which
  can be accessed synchronously. Reactive forms also provide a
  straightforward path to testing because you are assured that
  your data is consistent and predictable when requested.
  For more information go to:

Code Example 4

To set all FormGroup values use, setValue:

  formControlName1: myValue1, 
  formControlName2: myValue2
To set only some values, use patchValue:

  formControlName1: myValue1, 
  // formControlName2: myValue2 (can be omitted)

Learn ReactJs, React Native from