ng-lightning / ng-lightning

Native Angular components & directives for Lightning Design System

Home Page:http://ng-lightning.github.io/ng-lightning/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to pass array of type any to a Lookup

AtouiIlyes opened this issue · comments

I am trying to use ngl-lookup of the ngl-lightning library i want to pass an array of type any[] instead of String[], this is my code:
<ngl-lookup [lookup]="lookupManagerUsers" [icon]="true" [image]="'user'" [noResultsText]="'Aucun résultat trouvé'" [(pick)]="pickedManagerUser" (pickChange)="managerUserPicked($event)" placeholder="Recherchez un agent..." formControlName="manager_id" ngDefaultControl> <ng-template nglLookupItem let-item> <div class="slds-media__body"> <span class="slds-media__figure slds-listbox__option-icon"> <span class="slds-icon_container slds-icon-standard-user"> <svg class="slds-icon slds-icon_small" aria-hidden="true"> <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/assets/icons/standard-sprite/svg/symbols.svg#user" /> </svg> </span> </span>{{item}} </div> </ng-template> </ngl-lookup>
and this is my method

lookupManagerUsers = (query: string, source = this.manager_users): any[] => { let temp = []; if (!query) { temp = source; } else { const temp2 = source.filter(user => user.first_name.indexOf(query.toLowerCase()) > -1 || user.last_name.indexOf(query.toLowerCase()) > -1); for (const m of temp2) { temp.push(m); } } return temp;}
but this is really my problem :
capture d ecran 2019-02-13 a 9 37 14 am