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
original answer with a fix:
Observables are lazy. You have to call subscribe to tell an observable to send its request.
getEpic(id:number) {
return this.getEpics()
.filter(epic => epic.id === id)
.subscribe(x=>...);
}
Update to Rxjs 6:
import {filter} from 'rxjs/operators';
getEpic(id:number) {
return this.getEpics()
.pipe(filter(epic => epic.id === id))
.subscribe(x=>...);
}