Angular material 如何实现角材质垫选择更改事件?
我想在Angular Material中实现以下引导选择。如何实现bootstrap中显示的更改事件Angular material 如何实现角材质垫选择更改事件?,angular-material,Angular Material,我想在Angular Material中实现以下引导选择。如何实现bootstrap中显示的更改事件 <select (change)="sortByProducts($event.target.value)"> <option *ngFor="let filter of filters" [value]="filter.id"> {{filter.title}} </option> </select> {{fi
<select (change)="sortByProducts($event.target.value)">
<option *ngFor="let filter of filters" [value]="filter.id">
{{filter.title}}
</option>
</select>
{{filter.title}
如何将更改事件添加到调用sortByProducts函数的材质中,如上图代码段所示
<mat-form-field>
<mat-select>
<mat-option *ngFor="let filter of filters" [value]="filter.id">
{{filter.title}}
</mat-option>
</mat-select>
</mat-form-field>
{{filter.title}
您可以使用selectionChange输出:
// html
<mat-select (selectionChange)="sortByProducts($event.value)">
// ts
sortByProducts(value) {
console.log(value)
}
//html
//ts
sortByProducts(值){
console.log(值)
}
请参见您是否尝试在ts文件中使用
sortByProducts(事件)
执行
操作?是的。不起作用。