NG0956: The configured tracking expression (track by identity) caused re-creation of the...

Discussão em 'Angular' iniciado por DINESH KUMAR C, Março 15, 2025.

  1. 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

    Continue reading...

Compartilhe esta Página