簡體   English   中英

如何使用angular2-multiselect區分下拉值和選定值與下拉值?

[英]How to differentiate drop down value and selected value from drop down using angular2-multiselect?

我有一個要求,其中有一個多選下拉列表,並且下拉列表中的值具有“代碼-名稱”。 當我從下拉菜單中選擇時,它應該僅顯示“代碼”。 我在Angular2應用程序中使用angular2-multiselect。 請幫忙。

<angular2-multiselect 
    [data]="projectList" 
    [(ngModel)]="selectedProject" 
    [settings]="projectSettings" 
    (onSelect)="update($event)" 
    (onDeSelect)="update($event)" 
    (onSelectAll)="update($event)" 
    (onDeSelectAll)="update($event)"> 
</angular2-multiselect>

在您的組件文件中,您必須如下所述

this.settings = {singleSelection:true,文本:“ Select Categories”,selectAllText:'Select All',unSelectAllText:'UnSelect All',enableSearchFilter:true,badgeShowLimit:3,labelKey:'code',addNewItemOnFilter:true}; 在ngOnInit()和public settings = {};中(空數組),因為類變量“ lableKey”屬性將顯示在select中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM