I just noticed that my HTTP calls were not shared anymore between components. I am not sure since which version.
Already checked this solution: Angular2 observable share is not working
which makes the problem even worse (more HTTP calls), I must confess I always had a hard time understanding rxjs.
Here is my service function:
getSomeData(): Promise < any >
{
if(this.data) // should keep service from doing extra http for the same request
{
return Promise.resolve(this.data);
}
else
{
return this.http.post(this.createURL('getData',{}),JSON.stringify({}), this.createGetOptions())
.timeout(environment.timeout)
.share()
.map((response: Response) => {
return response;
}).toPromise();
}
}
I call it from different components
this.service.getSomeData().then((data: any) =>
{
if (data) {
...
createGetOptions
just adds headers like 'Content-Type': 'text/plain; charset=UTF-8'