Usage of [mat-dialog-close]

Set your button to have disabled on it if the form is not valid. This way the button cannot be clicked unless the form is valid, meaning it won’t close unless the form is valid

<button type="submit" (click)="addUser()" mat-dialog-close [disabled]="formisvalid" mat-button>Submit</button>

Leave a Comment