每次更改时如何获取角度选择的值?

问题描述 投票:0回答:1

我的html中有此代码

        <mat-form-field>
          <mat-label>Country</mat-label>
          <mat-select (change)="selectOpt($event)" required formControlName="country">
            <mat-option *ngFor="let country of countries" [value]="country.name" >
              {{country.name}}
            </mat-option>
          </mat-select>
        </mat-form-field>

每次选择不同的内容时,如何获取选择的值?我在选择垫子中有(change)事件,但没有捕获到该事件

angular html-select onchange
1个回答
0
投票

更改(selectionChange)="selectOpt($event)",它将起作用

© www.soinside.com 2019 - 2024. All rights reserved.