在Angular 5中使用ngformly从json创建时出错

时间:2018-06-07 04:44:03

标签: angular angular-forms angular-formly

我正在使用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)

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

1 个答案:

答案 0 :(得分:0)

问题是我在html中的表单上绑定设置有误。而不是[model] =&#34; model&#34;,我有(模型)=&#34;模型&#34;。问题已解决。