I have a TODOs list, (Todo[ ]) and I want to sort it every time I make
Perhaps the value todos
is null
at the beginning because it's loaded asynchronously using HTTP.
To prevent from such use case you could add this in your pipe:
@Pipe({
name: "sort"
})
export class TodosSortPipe implements PipeTransform {
transform(array: Todo[], args: any): Todo[] {
if (array == null) {
return null;
}
(...)
}
}
Then the value todos
will be received and the transform
method of the pipe will be called again with this non null value...
Moreover it seems that your tag isn't ended. You must have valid HTML into component templates. I don't know if it's the complete code or a truncated one...
Hope it helps you, Thierry