这里是因为ngModelChange在初始化就会运行,所以导致无法使用表单验证,这里改用selectionChange事件 问题解决
<mat-form-field>
<mat-select placeholder="{{'sysadmin.account.username' | translate}}" name="user" [(ngModel)]="account.accountId" (selectionChange)='setDetail()'
[formControl]="animalControl" required>
<mat-option *ngFor="let account of accountlist" [value]="account.accountId">{{account.username}}</mat-option>
<!-- <mat-option value="1"> test </mat-option> -->
</mat-select>
</mat-form-field>
<button mat-flat-button color="primary">Search</button>