title: Angular custom validation for FormArray fields (Reactive Form)
body: <p>I am new to Angular and would like to check how do I go about performing custom field validation for FormArray?</p>
  <p>The FormArray is dynamic where you can push or remove FormGroup items. The FormGroup consists of field1, field2, field3. If either one of the field is not null, the other fields should be set with validators.required. The form will be valid if all fields are either null or filled.</p>
  <p>Thanks.</p>
  <p>Below is the code sample:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>formA!: FormGroup;
  
  initializeForm(): void {
      this.formA = this.fb.group({
        item1: this.fb.array([this.createItem1()]),
        item2: this.fb.array([this.createItem2()]),
      });
    }
  
  createItem1(): FormGroup {
     return this.fb.group({
         field1: null,
         field2: null,
         field3: null,
     });
  }</code></pre>
  </div>
  </div>
  </p>