Is it posible to dynamically show length of array by using pipe? Here's my code:
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'lengthOfArray'
})
export class LengthOfArrayPipe implements PipeTransform {
transform(value: any): number {
return value.length;
}
}
I use it like this:
Component
listOfIdToExport: any[] = [];
Template
Element numer: {{ listOfIdToExport | lengthOfArray }}
I have a function which adds or removes elements from this array and problem is that pipe doesn't update array length when change occurs.