Issue with Angular mat-option tracking and selection
I'm having a problem with my Angular Material dropdown implementation. When I use the tracking feature in my @for
loop, the dropdown displays correctly, but selection functionality breaks.
Here's my current code:
@for(item of _optionData; track item){
<mat-option [value]="item.value?.toString()">
{{item.text}}
</mat-option>
}
I have a condition that works when I mention track: trackbiid
, but when I select something, it does not work.
How can I fix this issue so that both tracking and selection work properly? Is there something specific about how tracking interacts with the [value]
binding that I'm missing?
how to fix the issues