I have a function myFunc()
which i subscribe to.
If it is called with X then i want it to be a normal HTTP response from the Server.
If it is called without X, i want it to return a 'fake' http response with an empty array as a result.
How can i do this? I have tried returning an empty observable, but the subscribe never triggers.
myFunc(x) {
if (x) {
return this.http.get('myURL');
} else {
return Observable.from<Response>([])
}
}