javascript - Angular-Formly - 访问具有包含点(。)键名的计算字段的模型名称
问题描述
我有一个带有 3 个字段的配置 json,第 3 个字段是根据前 2 个字段中的数据计算得出的字段。现在这里的问题是我在他们的键名中有点(。)。例如“something.someone” 当我尝试渲染表单时,我得到一个显示未定义的错误。我的 config_json :
{
"fieldGroupClassName": "row",
"fieldGroup": [
{
"className": "col-2",
"key": "remarks_backflow.bed",
"type": "input",
"templateOptions": {
"type": "number",
"label": "Bed",
"placeholder": "",
"required": true
}
},
{
"className": "col-2",
"key": "remarks_backflow.gas",
"type": "input",
"templateOptions": {
"type": "number",
"label": "Gas",
"placeholder": "",
"required": true
}
},
{
"className": "col-2",
"key": "remarks_backflow.diff",
"type": "input",
"templateOptions": {
"type": "number",
"label": "Difference",
"placeholder": "",
"required": true
},
"expressionProperties": {
"model['remarks_backflow.diff']":"model['remarks_backflow.bed'] - model['remarks_backflow.gas']"
}
},
]
}
错误是:FormBuilderComponent.html:24 ERROR TypeError: [Formly Error] [Expression "model['pushin_temperature.kiln_id']"] Cannot set property 'kiln_id']' of undefined
提前致谢!
解决方案
上述问题已在 ngx-formly 的 github 线程和相同的链接中得到澄清和解决: ngx-formly github
推荐阅读
- r - 循环遍历多列并在 R 中绘制一个图(每个图都有误差线)
- reactjs - 反应中的警报标题
- http - 如何在 Camel 中的 HTTP 重定向期间过滤掉标头?
- azure - HTTP 错误 500.37 - ANCM 无法在启动时间限制内启动 - 增加启动时间限制后仍未解决
- reactjs - 在 ReactJS 中测试自定义钩子
- anylogic - 如何在属性中更改框架尺寸尺寸?
- python-camelot - python中的Camelot没有按预期运行
- python - 使用两列连接多个 CSV 文件
- c++ - C++中模板转换`operator const T &`的属性是什么?
- laravel - Livewire 数据表 - 转换列和过滤器