I am starting my project with Angular2 and the developers seem to recommend RXJS Observable instead of Promises.
I have achieved to retrieve a list of elements (epic
You'll want to filter the actual array and not the observable wrapped around it.
So you'll map the content of the Observable (which is an Epic[]) to a filtered Epic.
getEpic(id: string): Observable {
return this.getEpics()
.map(epics => epics.filter(epic => epic.id === id)[0]);
}
Then afterwards you can subscribe to getEpic and do whatever you want with it.