【问题标题】:Why Angular ReactiveForms FormArray throws error "TypeError: Cannot read property 'updateOn' of null"为什么Angular ReactiveForms FormArray抛出错误“TypeError:无法读取null的属性'updateOn'”
【发布时间】:2019-11-20 17:21:16
【问题描述】:

大家好,我有一个具有一组角色的 Formarray。在编辑期间,它会动态删除并添加该表单数组中的角色,直到这里一切正常,但是当我提交表单时,它会出现错误并且页面会刷新。

错误:TypeError:无法读取 null 的属性“updateOn”

另外我附上下面的截图

【问题讨论】:

    标签: angular6 angular-reactive-forms form-control formarray


    【解决方案1】:

    它对我有用

    确保您输入的是<button type="button" ></button> 而不是<input type="submit" />

    <button [ngClass]="(this.editMemberForm.invalid?'a1':'')" type="button" class="btn btn-success" (click)="saveData()">Save</button>
    

    【讨论】:

      【解决方案2】:

      仔细查看您在 formGroup 上所做的事情

      为我做一些 formGroup.removeControl("somefield");

      引发了同样的错误。

      【讨论】:

        猜你喜欢
        • 2021-01-19
        • 2017-10-29
        • 2020-09-02
        • 1970-01-01
        • 2021-11-24
        • 2018-11-05
        • 2020-02-20
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多