How to get the length of piped array in template?

Viewed 51

sample code: if not using pipe, I can get array length by:

<my-component [arrLen]='arrayA.length'></my-component>

But what if I want to get the length of a filtered array by a pipe? (Below not working)

<my-component [arrLen]='arrayA | arrayFilterPipe:filterParam'></my-component>

How to do this? Thanks

1 Answers

Replace your code

<my-component [arrLen]='arrayA | arrayFilterPipe:filterParam'></my-component>

To

<my-component [arrLen]='(arrayA | arrayFilterPipe:filterParam).length'></my-component>
Related