Reputation: 874
In Angular2 I can create a typeahead field looking at a datasource using ng2-bootstrap like this:
<input [typeahead]="dataSource.listOfObjects" ... />
Does anyone know if it's possible to have a conditional value that decides if an item is included in the typeahead?
For instance, it may look like:
<input [typeahead]="dataSource.listOfObjects where include == true" ... />
Upvotes: 2
Views: 1032
Reputation: 21688
You can make a pipe (in Angular 1 its called as filter) and process your data along with ng2-bootstrap
.
Another way is the make a function in your component which will return filtered data to use in your typeahead.
<input [typeahead]="functionInYourComponnet()" ... />
export class DataComopnent() {
functionInYourComponnet() {
...
...
return filteredData;
Upvotes: 1