[아이오닉] filter

0 views
Skip to first unread message

young chol seo

unread,
Nov 25, 2020, 9:04:24 PM11/25/20
to kamjaroid
getContactsByCategory(category: string): Observable<Contact[]> {
return this.getContacts().pipe(map(contacts => contacts.filter(contact => contact.category == category)));
}

getContactById(id: number): Observable<Contact> {
return this.getContacts().pipe(map(contacts => contacts.find(contact => contact.id == id)));
}

Reply all
Reply to author
Forward
0 new messages