Disable button in angular with two conditions?

后端 未结 5 1689
礼貌的吻别
礼貌的吻别 2020-12-25 09:31

Is this possible in angular ?


5条回答
  •  -上瘾入骨i
    2020-12-25 10:27

    Is this possible in angular 2?

    Yes, it is possible.

    If both of the conditions are true, will they enable the button?

    No, if they are true, then the button will be disabled. disabled="true".

    I try the above code but it's not working well

    What did you expect? the button will be disabled when valid is false and the angular formGroup, SAForm is not valid.

    A recommendation here as well, Please make the button of type button not a submit because this may cause the whole form to submit and you would need to use invalidate and listen to (ngSubmit).

提交回复
热议问题