ng2-ui / auto-complete

Angular Auto Complete component and directive
https://ng2-ui.github.io/dist/#/auto-complete
MIT License
279 stars 123 forks source link

Change Matching Engine #325

Closed AlexAbraham1 closed 6 years ago

AlexAbraham1 commented 6 years ago

Hi!

Is there a way to override the default matching engine for autocomplete? Specifically this github repo looks like it would match results more easily

https://github.com/farzher/fuzzysort

Thanks!

AlexAbraham1 commented 6 years ago

public tickerSearch(val:string): Observable<any> { var search = fuzzysort.go(val, this.tickers, {keys: ['tickerPrepared', 'namePrepared'], threshold: -5000}); return of(search); }

`<input auto-complete name="ticker" placeholder="Enter Ticker" [(ngModel)]="data.ticker" [source]="tickerSearch.bind(this)" [list-formatter]="tickerListFormatter" [value-formatter]="tickerValueFormatter" [max-num-list]=10 (valueChanged)="tickerChanged($event)"

`