How to make 'submit' button disabled?

Bonneville picture Bonneville · Aug 18, 2015 · Viewed 208.2k times · Source

How to disable the "Submit" button until the form is valid?

Does angular2 have an equivalent to ng-disabled that can be used on the Submit button? (ng-disabled doesn't work for me.)

Answer

Angular University picture Angular University · Aug 18, 2015

As seen in this Angular example, there is a way to disable a button until the whole form is valid:

<button type="submit" [disabled]="!ngForm.valid">Submit</button>