@Component({...})
export class SearchableContainerComponent {
private _count = 0;
get count() {
return this._count;
}
set count(count: number) {
this._count = count;
}
...
private handleSearchables(searchTerm: string) {
let count = 0;
for (const searchable of this.searchables) {
if (!searchTerm) {
searchable.show();
count++;
} else {
if (this.match(searchable)) {
searchable.show();
count++;
} else {
searchable.hide();
}
}
}
this.count = count;
}
...
}