angular - 如何在每次更改时获取 Angular 选择的值?
问题描述
我的 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>
每次选择不同的东西时,如何获取 select 的值?我的 mat-select 中有(更改)事件,但它没有捕捉到该事件
解决方案
改变(selectionChange)="selectOpt($event)"
它,它会工作
推荐阅读
- .net-core - dot net core 3.1 中 Microsoft.AspNet.WebApi.Core 的替代品
- bash - 将所有java文件复制到指定文件夹
- mysql - 具有两个表并按计数分组的复杂 SQL 查询
- python - Python-firebase 库给出异常
- html - 带边框和 figcaption 的图像
- java - 如何检查我们是否应该去谷歌搜索或只是简单的加载网址
- hyperledger-fabric - 尝试使用 Fabric-ca 启动对等体时 msp 出错
- discord.py - discord.py Selfbot 无法获取公会用户
- angular - Vidyo.io 远程 JS 不可用
- python - 拖放移动时的选择问题,PyQt5