首页 > 解决方案 > 如何在按钮的禁用属性中添加多个条件

问题描述

我想根据两个条件禁用我的按钮。

  1. 表格无效
  2. 什么时候authenticationType是真的

我尝试了很多类似下面的东西。

[disabled]="!userForm.form.valid && authenticationType" <br>

[disabled]="(!userForm.form.valid===true && authenticationType===true) ? true : false"

但对我没有用。请帮忙

标签: javascriptangulartypescriptangular8

解决方案


[禁用]="!userForm.form.valid || authenticationType"


推荐阅读