AngularJS:ng-disabled传递超过1个表达式?

时间:2021-08-06 19:42:00

Does anyone know if its possible to have ng-disabled use 2 expressions. I would like to disable the buttton when its clicked, this is to stop DOUBLE POSTBACK but i would also like it disabled until the form is valid i.e.

有没有人知道是否可以使用ng-disabled使用2个表达式。我想在点击时禁用按钮,这是为了停止DOUBLE POSTBACK但我也希望它禁用,直到表格有效,即

  <button ng-disabled="!myForm.$valid" ...............

But what about double postback.

但是双回发呢。

Is this possible ?

这可能吗 ?

Thanks in advance

提前致谢

1 个解决方案

#1


20  

You can do something like:

你可以这样做:

ng-disabled="condition1 || condition2"

condition1 would be your validation and the contition2 would be when the button has been clicked. Setting either to true will disable the button.

condition1将是您的验证,contition2将是单击按钮的时间。将其设置为true将禁用该按钮。

#1


20  

You can do something like:

你可以这样做:

ng-disabled="condition1 || condition2"

condition1 would be your validation and the contition2 would be when the button has been clicked. Setting either to true will disable the button.

condition1将是您的验证,contition2将是单击按钮的时间。将其设置为true将禁用该按钮。