By using Http, we call a method that does a network call and returns an http observable:
getCustomer() {
return
Have you tried running the code you already have?
Because you are constructing the Observable from the promise resulting from getJSON()
, the network request is made before anyone subscribes. And the resulting promise is shared by all subscribers.
var promise = jQuery.getJSON(requestUrl); // network call is executed now
var o = Rx.Observable.fromPromise(promise); // just wraps it in an observable
o.subscribe(...); // does not trigger network call
o.subscribe(...); // does not trigger network call
// ...