I'm currently developing an angular 4 application and I am dealing with a large array of objects (around 200 rows). To improve user experience, I added a search input field that dynamically filters the displayed content based on what the user types. Here's how it looks in my code:
<input type="text" [(ngModel)]="searchtext" placeholder="Search">
<div *ngFor="let m of (devices | filterEquipments : searchtext)">{{ m.name }}</div>
However, I noticed that the filtering process is quite slow when I start typing. After some research, I found out that using "trackBy" in the ngFor directive can help optimize performance. The challenge now is figuring out how to implement it correctly and whether it will actually make the filtering faster.
Does anyone have suggestions on how to implement a more efficient filtering solution?