I have a little problem, I have this:
foo = {
parent1:[{
data: "John",
},
{
data: "Adam",
},
{
data: "Eva",
}],
parent2:[{
data: "Ricky",
}]
}
and my autocomplete:
<input type="text" matInput [formControl]="query" [matAutocomplete]="autoGroup"/>
<mat-autocomplete #autoGroup="matAutocomplete">
<mat-optgroup *ngFor="let parents of foo | keyvalue" [label]="parents.key">
<mat-option *ngFor="let data of parents.value" [value]="data.data">
{{ data.data }}
</mat-option>
</mat-optgroup>
</mat-autocomplete>
And I want to set it a filter - I just want to filter by "data", for ex. if i type "John" - it will only remain John with optgroup "parent1" I've created demo:
https://stackblitz.com/edit/angular-syzdzg-ytejbp?file=src%2Fapp%2Fautocomplete-filter-example.html
Thanks in advance!