I am using track by function in my ionic angular app and while building the app, it gives me error: Type '(index: any, item: any) => any' is missing the following properties from type 'any[]': pop, push, concat, join, and 25 more.
I am using this function as:
html:
<div *ngFor="let group of groups; index as i; trackBy: trackByFn | groupFilter: searchGroup">
component:
trackByFn(index, item) {
return item.key;
}
any idea what am i doing wrong? Thanks for help.
you are using filter in wrong place. the correct variant would be
<div *ngFor="let group of groups | groupFilter: searchGroup; index as i; trackBy: trackByFn">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.