As Http is Observable powered, it makes more semantic sense for requests to be "lazy", that is, nothing should happen until .subscribe is called somewhere downrange.
Currently, calling http.get(url) will immediately fire off an XHR, irrespective of whether or not the request has been subscribed to. This is probably a side-effect of the EventEmitter using a Subject (and thus could be resolved when RxNext goes in) - generally we should opt for Observables for such things and only use Subjects when necessary.
See http://plnkr.co/edit/ncg5Kx?p=preview for a reproduction / naive semantically better implementation.
Suggested fix would be having backends etc initialize and return an Observable that could be .mapped to the Response
As Http is Observable powered, it makes more semantic sense for requests to be "lazy", that is, nothing should happen until .subscribe is called somewhere downrange.
Currently, calling
http.get(url)will immediately fire off an XHR, irrespective of whether or not the request has been subscribed to. This is probably a side-effect of the EventEmitter using a Subject (and thus could be resolved when RxNext goes in) - generally we should opt for Observables for such things and only use Subjects when necessary.See http://plnkr.co/edit/ncg5Kx?p=preview for a reproduction / naive semantically better implementation.
Suggested fix would be having backends etc initialize and return an Observable that could be .mapped to the Response