我在一个html文件中有两个材料组件,并且在同一个表单中 . 这些是在角材料版本6.0.0上完成的

<mat-form-field [hideRequiredMarker]="hideRequired" [floatLabel]="floatLabel" class="mat-form-field-infix">
      <mat-select id="select-status" formControlName="state" required disableOptionCentering>
        <mat-option *ngFor="let status of statuses" [value]="status.value">{{ status.display | translate:{ company_name: (companyName$ | async) } }}</mat-option>
      </mat-select>
    </mat-form-field>

<mat-radio-group formControlName="rating">
      <mat-radio-button id="feedback-rating-{{ rating }}" class="feedback-rating" *ngFor="let rating of ratings" [value]="rating">
        {{ rating }}
      </mat-radio-button>
    </mat-radio-group>

当我将它们与反应形式一起使用时,即使不选择值,当您触摸mat-select时,无线电组的选定值也会更改为最后一个值 . (例如,如果单选按钮选项为1到5,则在触摸mat-select时将自动选择5) . 我认为这是因为反应形式,因为当我删除和formControlName时,更改mat-select的值不会影响mat-ratio-group的当前选定值 . 这是形式的初始化

this.form = this.formBuilder.group({
  state: [null, [Validators.required]],
  rating: [null, [Validators.required]]
});

有什么我错过了吗?或者有没有人经历过这种行为?如果是这样,你做了什么?

编辑:上述行为不会再发生 . 它只在第一次触摸mat-select时发生