禁用按钮有两个条件吗? [英] Disable button in angular with two conditions?
本文介绍了禁用按钮有两个条件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这在角度上可能吗?
<button type="submit" [disabled]="!validate && !SAForm.valid">Add</button>
我希望如果两个条件都成立,它们将启用该按钮.
I expect that if both of the conditions are true they will enable the button.
我已经尝试了上面的代码,但是没有按预期工作.
I've already tried the above code but it's not working as expected.
推荐答案
听起来您需要使用OR,而不是:
It sounds like you need an OR instead:
<button type="submit" [disabled]="!validate || !SAForm.valid">Add</button>
如果未通过验证或未通过SAForm.valid,则将禁用该按钮.
This will disable the button if not validate or if not SAForm.valid.
这篇关于禁用按钮有两个条件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文