Skip to content

Instantly share code, notes, and snippets.

@NetanelBasal
Created November 16, 2018 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NetanelBasal/b465362fc653eae6e10a0d6b16da5944 to your computer and use it in GitHub Desktop.
Save NetanelBasal/b465362fc653eae6e10a0d6b16da5944 to your computer and use it in GitHub Desktop.
@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;
}
...
}
@dedeyusup10
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment