mardi 8 octobre 2019

Angular mat-checkbox performance issue

I have a mat-list with a mat-checkbox next to each list item. The list is about 700-800 element long. Whenever I click the checkbox there's a huge delay between the check-mark appearing and clicking it. Any ideas what might cause it? I read it that Angular iterates through every element even if only one is getting changed due to change detection, but even if that's the case, I don't know how to avoid this problem.

<mat-list>
    <mat-list-item *ngFor="let listItem of productList">    
        <span (click)="selectProduct(listItem)">
            <div matLine></div>
            <div matLine></div>
        </span>
        <mat-checkbox class="example-margin check-box" name="listItem.name" [(ngModel)]="listItem.checked"></mat-checkbox>
        <mat-divider></mat-divider>
        </mat-list-item>
</mat-list>



Aucun commentaire:

Enregistrer un commentaire