disable submit button if input is empty angular code example

Example 1: make button disabled if input is empty angular

<button type="submit" [disabled]="!name || !email" class="btn btn-default" (click)="getValues($event, name, email)">Add Data</button>

Example 2: make button disabled if input is empty angular

<input type="text" class="form-control" [(ngModel)]="name" id="name" placeholder="John Doe">

<input type="email" class="form-control" [(ngModel)]="email" id="email" placeholder="[email protected]">