title: Angular How to get value in form array?
body: <p>I want to get 'onduty' values from all form array's instance.
  I tried this in html:</p>
  
  <pre><code>&lt;span *ngFor="let day of workDayandTime.controls;let i= index;"&gt;
   {{day.onduty}}
  &lt;/span&gt;
  </code></pre>
  
  <p>but I couldn't get any value.</p>
  
  <p>this is workDayandTime's value in json :
  <a href="https://i.stack.imgur.com/7m1Qb.jpg" rel="nofollow noreferrer">workDayandTime form array</a></p>
  
  <p>Form :</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>class employerShortForm extends FormGroup {
      constructor(fb: FormBuilder) {
          super({
              employer: fb.group({
                  name: new FormControl('',Validators.required),
              }),
              employee: fb.group({
                  name: new FormControl('', Validators.required)
              }),
              contractStart: new FormControl(''),
              contractEnd: new FormControl(''),
              workAddress: new FormControl('', Validators.required),
              work: new FormControl('', Validators.required),
              workDayandTime: fb.array([]),
              wageType: new FormControl(''),
              wage: new FormControl(''),
              bonus: new FormControl(''),
              otherWage: fb.array([]),
              otherwageRadio: new FormControl(''),
              overTimeAddRate: new FormControl(''),
              payDateType: new FormControl(''),
              payDate: new FormControl(''),
              payMethod: new FormControl(''),
              insurance1: new FormControl(''),
              insurance2: new FormControl(''),
              insurance3: new FormControl(''),
              insurance4: new FormControl(''),
              company: fb.group({
                  name: new FormControl('', Validators.required),
                  phone: new FormControl('', Validators.required),
                  address: new FormControl('', Validators.required),
              }),
              ownerName: new FormControl('', Validators.required),
              employeeEmail: new FormControl('', Validators.required),
          });
      }
  
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>short-time-paper.ts</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>import { employerShortForm, employeeContForm, DataHandling, otherWage, workDayandTime} from '../../../contract-form'
  import { FormGroup, FormControl, FormBuilder, FormArray } from '@angular/forms';
  import { Component, AfterViewInit, ElementRef, Renderer2, ViewChild } from '@angular/core';
  import { IonicPage, ViewController, ModalController, NavParams, Alert, NavController, Checkbox, Platform } from 'ionic-angular';
  
  @Component({
    selector: 'app-short-time-paper',
    templateUrl: 'short-time-paper.html',
  })
  export class ShortTimePaperComponent implements AfterViewInit{
    public employerForm: employerShortForm = new employerShortForm(this.fb);
    ngAfterViewInit() {
      this.addworkDayandTime();
    }
  get workDayandTime(): FormArray{
      return this.employerForm.get('workDayandTime') as FormArray;
    }
    
    public addworkDayandTime() {
      for (let i = 0; i &lt; 7; i++) {
        this.workDayandTime.push(this.fb.group(new workDayandTime()));
      }
    }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>short-time-paper.html</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>    &lt;form [formGroup]="employerForm"&gt;
            &lt;span *ngFor="let day of workDayandTime.controls;let i= index;"&gt;
              {{day.onduty}}
              &lt;span *ngIf="day.onduty=='false'"&gt;{{getDays(i)}},&amp;nbsp;&lt;/span&gt;
            &lt;/span&gt;
      &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I dropped other code but about formarray,
  What I wanna know is How can I get each instance's 'onduty' value in array.
  Sorry for my short of Eng. But if you help to solve this problem. It'll be big pleasure for me. thanks.</p>