title: Angular 5 Form validation on form array fields
body: <p>I am working on a project where I want to put required validation on a form array field.
  Here is my template</p>
  
  <pre><code> &lt;div  formArrayName="price" *ngFor="let p of vehicleForm.get('prices.price').controls; let i=index"&gt;
          &lt;div class="price-form-repeater" [formGroupName]="i"&gt;
  
                  &lt;div class="col-md-6 col-sm-12 cust-col"&gt;
                      &lt;label class="col-sm-4 dark-label" for="priceType"&gt;Price Type:&lt;/label&gt;
                      &lt;div class="col-md-6" &gt;
                      &lt;select id="priceType" formControlName="type" class="form-control" data-placeholder="select"  &gt;
                          &lt;option &gt;&lt;/option&gt;&lt;!-- Required for data-placeholder attribute to work with Chosen plugin --&gt;
                          &lt;option value="public"&gt;Public&lt;/option&gt;
                      &lt;/select&gt;
  
                      &lt;div *ngIf="p.controls.type.errors  &amp;&amp; (p.controls['type'].dirty || p.controls['type'].touched)) ||
                      (p.controls['type'].untouched &amp;&amp; formSubmitAttempt)"class="alert alert-danger"&gt;
                          &lt;div [hidden]="(!p.controls['type'].errors.required)"&gt;Price type is required.&lt;/div&gt;
                      &lt;/div&gt;  
                      &lt;/div&gt;
                  &lt;/div&gt;
          &lt;/div&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>Here is my component</p>
  
  <pre><code>  prices: this.fb.group({
      price: this.fb.array([this.priceField()]) ,
  })
  
  priceField():FormGroup {
    return this.fb.group({
      type: ['',Validators.required],  
      vat_type: ['',Validators.required], 
      currency: ['',Validators.required],  
      negotiable: ['',Validators.required], 
      value: ['',Validators.required],  
      tax_deduction: ['',Validators.required]  
    });
  }
  </code></pre>
  
  <p>I just want to show the required field error message if the user tries to leave these fields empty. I appriciate your help.</p>