我正在使用https://www.npmjs.com/package/@ng-select/ng-select進行自動完成暨下拉串列。如何插入諸如“請選擇”之類的內容作為其中的第一個元素。
我實作了包如下。這是我的 html 檔案
<ng-select [items]="items"
bindLabel="Name"
autofocus
bindValue="Id"
(close)="close()"
(clear)="clear()"
placeholder="Select people"
[(ngModel)]="selectedId">
</ng-select>
uj5u.com熱心網友回復:
從那里演示頁面,使用placeholder="Select age"
<ng-select #agesSelect [items]="ages"
[selectOnTab]="true"
bindValue="value"
labelForId="age"
(ngModelChange)="showConfirm(confirmation)"
placeholder="Select age"
formControlName="age">
代碼:https : //stackblitz.com/run?file=src/forms-single-select-example.component.html
演示:https : //ng-select.github.io/ng-select#/forms
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/343773.html
標籤:有角的
