Is this possible in angular ?
<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.
To disable button in Angular, we set the [disabled] attribute. to set the [disabled] attribute to 'disabled' if editmode is false . Otherwise, we set it to null to keep the button enabled.
Component tsactionMethod($event: MouseEvent) { ($event. target as HTMLButtonElement). disabled = true; // Do actions. }
Or you can use ng-disabled="condition1 || condition2" , is depend of you logic conditional.
It sounds like you need an OR instead:
<button type="submit" [disabled]="!validate || !SAForm.valid">Add</button>
This will disable the button if not validate or if not SAForm.valid.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With