it is possible (and correct) to create a custom observable ? For example, if i have data in my cache, i would like create custom observable before make a http request:
my request:
private device: Device;
getDeviceById(deviceId): Observable<Device> {
if(this.device._id == deviceId) {
let myObservable = new Observable('with my device');
return myObservable;
} else return this.http.get('/api/device/get/'+deviceId)
.map(res => res.json())
.catch(this.handleError);
}
Thank's