<mat-form-field [ngClass]="classes">
<mat-select [placeholder]="placeholder" [(ngModel)]="selectValue" [multiple]="true" #multiSelect (change)="onChange()"
#itemSelect="ngModel">
<ngx-mat-select-search [formControl]="multiFilterCtrl"></ngx-mat-select-search>
<mat-option *ngFor="let option of filteredMulti | async" [value]="option.id">
{{option.name}}
</mat-option>
</mat-select>
</mat-form-field>
角度材料多选如何设置值以选择从api来的多选下拉列表?
答案 0 :(得分:1)
如果您要设置选定的值,则可以
$('.add-to-cart').click(function() {
var quantity = 1;
var clickedProdId = $(this).attr('data-val');
var id = $('#hidden_'+ clickedProdId).val();
alert("Product id is " + id + " and quantity is: " +quantity);
});