我正在使用 mat-autocomplete,因为当我选择下拉菜单并滚动主栏时,该下拉框不会随自动完成输入字段一起移动。 在此处输入图像描述
代码:
<td width = 24% *ngIf="!stock.value.status_item">
<input style="width: 167px;" type="text" placeholder="Select Item" #editInput tabindex="1" class="form-control"
matInput [matAutocomplete]="itemsAuto" [(ngModel)]="stock?.value.commodity_name" [ngModelOptions]="{standalone:true}" [disabled]=" stock.value.confirm_status" (input)="onSearch(stock?.value.commodity_name)" >
<mat-autocomplete #itemsAuto="matAutocomplete" (opened)="autocompleteScroll()">
<mat-option *ngFor="let item of ingredients" [value]="item.name" [disabled]="!isItemAvailable(item)" (click)="addStockManully(item,i)">
{{item?.name}}
<span class="styled__SelectionIcon-sc-5ssw50-7 bUDhvO" *ngIf="!isItemAvailable(item)">
</span>
<span class="styled__SelectionIcon-sc-5ssw50-7 bUDhvOs" *ngIf="isItemAvailable(item)">
</span>
</mat-option>
</mat-autocomplete>
</td>