简体   繁体   English

formbuilder里面的标签组件不工作在角度6

[英]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. 但formbuilder抛出错误,说它无法找到formControlName。

this is the stackblitz link formBuilderInsideTabs and the error screenshot of the same. 这是stackblitz链接formBuilderInsideTabs和错误截图相同的。 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. 请注意,我在html中使用了formGroupName而不是FormGroupName

Here is the working demo 这是工作演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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