【问题标题】:Error creating from json using ngformly in Angular 5在 Angular 5 中使用 ngformly 从 json 创建时出错
【发布时间】:2018-06-07 04:44:03
【问题描述】:

我正在使用 Angular 5 使用 ng-formly 库创建表单,但我遇到了下面的这个错误。我在网上使用了他们的示例,但在我的项目中使用时,无法理解为什么他们的核心项目中存在问题。

OrderComponent.html:33 ERROR TypeError: Cannot add property model, object is not extensible
    at eval (ngx-formly-core.js:90)
    at Array.forEach (<anonymous>)
    at assignModelToFields (ngx-formly-core.js:86)
    at FormlyFormBuilder.buildForm (ngx-formly-core.js:503)
    at FormlyForm.ngOnChanges (ngx-formly-core.js:825)
    at checkAndUpdateDirectiveInline (core.js:12407)
    at checkAndUpdateNodeInline (core.js:13935)
    at checkAndUpdateNode (core.js:13878)
    at debugCheckAndUpdateNode (core.js:14771)
    at debugCheckDirectivesFn (core.js:14712)

知道为什么我会收到此错误消息吗?

【问题讨论】:

  • 您能否将代码添加到指出错误的问题中?
  • OrderComponent.html中出现错误。请提供其代码。

标签: angular angular-forms angular-formly


【解决方案1】:

问题是我在 html 中的表单上的绑定设置错误。而不是 [model]="model",我有 (model)="model"。问题已解决。

【讨论】:

    猜你喜欢
    • 2019-09-30
    • 1970-01-01
    • 1970-01-01
    • 2018-10-18
    • 2015-07-03
    • 1970-01-01
    • 2020-01-04
    • 2018-06-28
    • 2018-10-21
    相关资源
    最近更新 更多