Recently, I decided to experiment with a new autocompleter tool that is unfamiliar to me: https://github.com/oferh/ng2-completer. I successfully imported it and it seems to be functioning properly.
My current goal is to retrieve the values of the selected item once it has been chosen:
<ng2-completer [(ngModel)]="searchStr"
[inputClass]="'form-control form-control-inline'" [datasource]="getSelectedItemArray?"
[minSearchLength]="0"></ng2-completer>
Selections :
protected searchData = [
{ name: 'Bus UK LTD', address: 'Example', address2: 'Example2',
pscode: '8497UK', ccode: '877SAD', veh1: '84A4DA', veh2: '846ASD', trail1: '486XSS', trail2: '8746SS' },
...
];
constructor(private completerService: CompleterService) {
this.dataService = completerService.local(this.searchData, 'name', 'name');
}
To summarize - I select an item from a list which populates the input value, but then I want to access all the details of that selected item (such as name, address, etc.). How can I achieve this?