How can I make only one http request but subscribe multiple times to the service?
The documentation states that they are called multiple times:
const req = http.get<Heroes>('/api/heroes');
// 0 requests made - .subscribe() not called.
req.subscribe();
// 1 request made.
req.subscribe();
// 2 requests made.
Source: https://angular.io/guide/http#making-a-delete-request (a bit down).
Is there a way, that the http request is done only once?
Background: I'm making a service which checks if the requests are identically, and if yes, it returns the last observable
. Now if the requests are made twice this "optimization" becomes obsolete.
All related answers are to Angular