Situation:
Wanted result:
Question:
How would one approach this situation? I've read a little about some type pf parent/child solution - but I dont feel as I quite understand how that would work in my case.
PS. If anyone feels as the question is not accurate enough - you may change it!
@Output() search: string;
<app-search (search)="searchStr = $event"></app-search>
get displayList() {
return this.list.reduce((sum, value) => {
if (value.name.substring().indexof(this.searchStr.substring()) > -1) {
sum.push(value);
}
return sum;
}, []);
}
<ul>
<li *ngFor="let item of displayList">{{ item.name }}</li>
</ul>
Hope this help
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.