最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

angular - NG0956: The configured tracking expression (track by identity) caused re-creation of the entire collection of size 7 -

programmeradmin6浏览0评论

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

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论