ng2-ui / auto-complete

Angular Auto Complete component and directive
http://ng2-ui.github.io/auto-complete/
MIT License
280 stars 124 forks source link

TypeError: _this.getFormattedListItem(...).toLowerCase is not a function #375

Closed ChungMichel closed 2 months ago

ChungMichel commented 5 years ago

Hello,

I'm having an issue with attribute [list-formatter]="myfunction". It is working when I'm using list-formatter="name". I'm following the example at this URL : Link

This is my error : ERROR TypeError: _this.getFormattedListItem(...).toLowerCase is not a function at auto-complete.js:18 at Array.filter (<anonymous>) at NguiAutoComplete.filter (auto-complete.js:17) at NguiAutoCompleteComponent.reloadList (auto-complete.component.js:146) at auto-complete.component.js:56 at t.invokeTask (polyfills.js:3) at Object.onInvokeTask (core.js:4751) at t.invokeTask (polyfills.js:3) at r.runTask (polyfills.js:3) at e.invokeTask (polyfills.js:3)

HTML : <input auto-complete [open-on-focus]="false" [source]="allDatas" max-num-list="7" id="searchbar_input" match-formatted="true" value-formatter="name" [list-formatter]="test" min-chars="2" no-match-found-text="Aucun résultat trouvé..." loading-text="Recherche en cours..." (valueChanged)="findObject(allDatas, $event)" [(ngModel)]="searchbar_value" type="text" style="width: 100%" placeholder="Saisissez votre recherche" >

TS : test = (data: any) => { let html =${data.name} ${data.id} ; return this.sanitizer.bypassSecurityTrustHtml(html); }

I'm currently using Ionic 3, is it a problem with my Angular version? (Version 4 or 5 I can't remember clearly)

Thanks for your future help!

almothafar commented 2 months ago

This issue is stale. Please consider opening a new issue with details for the latest version if you are still facing the same issue or need improvement.

Closing it.