Q:

Autocomplete with arrray?

I have this autocomplete component:
 <z-autocomplete class="z-autocomplete" *ngIf="!ipaddress.rinvapnId" (selectedChange)="onSelect($event)" [suggestion]="results"  (searchEvent)="search($event)" [fieldname]="'addressname'" ></z-autocomplete>

In ts i have this:
search(e){

    console.log(this.IPresults.includes(a=>a.apn==e.query),'aaa');
}

How to return all data from array that starts with that string ? something LIKE method in sql. Any suggestion?

A:

All you need is filter function :
return this.IPresults.filter(result => result.startsWith(e.query) );

Above snippet is just answer of How to return all data from array
  that starts with that string ? , you can do that many ways (e.g.
  regex) . 
Its all about how you implements the logic.

