title: Getting error while using Angular Form Array
body: <p>Why am I getting this error, and how to get it fixed:
  TS2740: Type 'AbstractControl&lt;any, any&gt;' is missing the following properties from type 'FormGroup': controls, registerControl, addControl, removeControl, and 2 more.</p>
  <p>At this point it is giving error in my html:
  <a href="https://i.stack.imgur.com/CQqqC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CQqqC.png" alt="enter image description here" /></a></p>
  <p>my html:</p>
  
  <pre><code>&lt;button type=&quot;button&quot; (click)=&quot;addName()&quot;&gt;Add Name&lt;/button&gt;
  
  &lt;div formArrayName=&quot;names&quot;&gt;
      &lt;div *ngFor=&quot;let nm of getNames.controls&quot;&gt;
          &lt;div [formGroup]=&quot;nm&quot;&gt; //THIS LINE IS GIVING ERROR
              &lt;input formControlName=&quot;fname&quot; type=&quot;text&quot; placeholder=&quot;First Name&quot;&gt;
              &lt;input formControlName=&quot;lname&quot; type=&quot;text&quot; placeholder=&quot;Last Name&quot;&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt; 
  
  &lt;div&gt;
      &lt;button type=&quot;submit&quot;&gt;Submit&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>my ts:</p>
  <pre><code>export class TestComponent implements OnInit {     
      constructor(private fb: FormBuilder) { }
  
      form = this.fb.group({
          names: this.fb.array([])
      });
  
      get getNames(){
          return this.form.controls[&quot;names&quot;] as FormArray;
      }
  
      addName(){
          const newName = this.fb.group({
              fname: ['', Validators.required],
              lname: ['', Validators.required]
          });
          this.getNames.push(newName);
      }
  
      onSubmit():void{
          console.log(this.form.value)
      }
  
     ngOnInit(): void {
  
     }
  
  }
  </code></pre>