title: Getting an error: formGroup expects a FormGroup instance. Please pass one in
body: <p>I am trying to use <code>reactive forms</code> for dynamic values added on click of button. I am getting below error:</p>
  
  <blockquote>
    <p>formGroup expects a FormGroup instance. Please pass one in</p>
  </blockquote>
  
  <p>Here is my example: <a href="https://stackblitz.com/edit/dynamic-reactive-forms-add-zqaqjc" rel="nofollow noreferrer">dynamic-reactive-forms</a></p>
  
  <p>I am new to <code>reactive forms</code>. Some code in <code>ts</code> file:</p>
  
  <pre><code>let numberOfTiles = document.getElementsByClassName("tiledata").length;
      if (this.t.length &lt; numberOfTiles) {
        for (let i = this.t.length; i &lt; numberOfTiles; i++) {
          this.t.push(this.formBuilder.group({
            tabName: ['', Validators.required],
            dashboardName: ['', Validators.required],
            linkTo: ['', Validators.required],
            linkSelected: ['', Validators.required]
          }));
        }
  }
  
  get f() { return this.dynamicForm.controls }
    get t() { return this.f.alltabs as FormArray; }
  
    onSubmit() {
      this.submitted = true;
      if (this.dynamicForm.invalid) {
        return;
      }
      alert('SUCCESS!! :-)\n\n' + JSON.stringify(this.dynamicForm.value, null, 4));
    }
  </code></pre>