This is because you have data as input, which is loaded asynchronously using an HTTP request.
You need to check this before using the filter:
export class SortByNamePipe {
transform (value, [queryString]) {
if (value==null) {
return null;
}
return value.filter((student)=>new RegExp(queryString).test(student.name))
// return value;
}
}
source
share