我在我的应用中使用了 mat-select 小部件(角材料)
我正在选择Drowpdown顶部的搜索栏实现:
<mat-select placeholder="Selectionner la boutique"
id="libelleShop">
<div id="custom-search-input" class="m-1 navbar-fixed-top">
<input #shopKeyword matInput placeholder="Search" class="search-input" (keyup)="filterShopsByLibelle(shopKeyword.value)">
<span class="input-group-btn">
<button class="btn btn-danger" type="button">
<span class="glyphicon glyphicon-search"></span>
</button>
</span>
</div>
<mat-option *ngFor="let shop of bad3ShopsListSortedByName"
[value]="shop.edoId">
{{shop.storeName}}
</mat-option>
</mat-select>
我的目的是如何将搜索Bard div(#custom-search-input)固定在顶部。
我尝试过position: fixed
,但似乎不起作用
建议
答案 0 :(得分:0)
解决方案1
<mat-select-search [formControl]="formControlName"></mat-select-search>
将此标签添加到mat-select内,并遵循StackBlitz的app.component.ts中的步骤
解决方案2
您可以使用Autocomplete的Angular材质
https://material.angular.io/components/autocomplete/overview