【发布时间】:2018-08-30 06:03:43
【问题描述】:
我需要获取 mat-select 的数据,特别是文本及其值。到目前为止,这就是我实现 mat-select 的方式..
<mat-select
placeholder="Transaction Type"
(selectionChange)="selected($event)"
formControlName="TransactionTypeID"
>
<mat-option *ngFor="let t of transactionTypes" [value]="t.TransactionTypeID">
{{ t.TransactionType }}
</mat-option>
</mat-select>
这就是我在 .ts 文件中获取值的方式:this.formDetail.get('TransactionTypeID').value,
这是我尝试获取文本或't.TransactionType':
selected(event: MatSelectChange) {
console.log(event);
}
你能告诉我怎么做吗?谢谢。
【问题讨论】: