简体   繁体   中英

formbuilder inside a tabs component not working in angular 6

i am trying to build a form which is divided across mutiple tabs in a single component. but formbuilder is throwing error saying that its not able to find the formControlName.

this is the stackblitz link formBuilderInsideTabs and the error screenshot of the same. enter image description here

Thanks in advance

Try:

<my-tabs>
  <my-tab [tabTitle]="'Tab 1'">
    <form [formGroup]="MyGroup">
      <div formGroupName="averageMos">
        <input type="text" formControlName="critical">
      </div>
    </form>
  </my-tab>
  <my-tab tabTitle="Tab 2">
    Tab 2 content
  </my-tab>

</my-tabs>

Please note that I have used formGroupName and not FormGroupName in html.

Here is the working demo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM