【问题标题】:In angular-formly hideExpression remove fields from the DOM but not from the MODEL在 angular-formly hideExpression 从 DOM 中删除字段,而不是从 MODEL
【发布时间】:2018-05-24 07:40:27
【问题描述】:

当由于 hideExpression 从 DOM 中删除字段时,其在模型中的值仍会退出并在提交时发送。

使用

角度形式 v8.4.1 angular-formly-templates-bootstrap 版本 6.5.1

¿如何从 de 模型中删除隐藏字段或将其设置为 null?。

这里有一个问题示例: http://angular-formly.com/#!/example/field-options/hide-fields

如果复选框被隐藏,我希望复选框状态不要在模型中发送。

因为如果此复选框用于隐藏另一个第三个字段,如果我们在选中时隐藏复选框(在其上使用 hideExpression),第三个字段仍会显示在 DOM 中,这有点奇怪,因为如果删除了第三个复选框必须删除依赖字段。

我已经能够观察到,通过简单地将 null 放入模型中,不再在 DOM 中的字段完美地隐藏了链中的依赖字段

隐藏字段时请帮忙刷新模型。

提前谢谢你(对不起我的英语不好)

【问题讨论】:

    标签: angular-formly


    【解决方案1】:

    将其设置为使用 ng-if 作为 formly-form 中的 hideDirective

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-06-17
      • 1970-01-01
      • 2017-09-15
      • 2017-04-22
      • 2021-12-05
      • 2019-10-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多