How to make 'submit' button disabled? How to make 'submit' button disabled? angular angular

How to make 'submit' button disabled?


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>


in Angular 2.x.x , 4, 5 ...

<form #loginForm="ngForm">    <input type="text" required>     <button  type="submit"  [disabled]="loginForm.form.invalid">Submit</button></form>


.html

<form [formGroup]="contactForm"><button [disabled]="contactForm.invalid"  (click)="onSubmit()">SEND</button>

.ts

contactForm: FormGroup;