I have 3 independent places in my code which call VerificationService
method getOrganizationView()
.
getOrganizationView(): Observable<any> {
return this.httpClient.http.post(...)
}
First place is principal service:
@Injectable()
export class Principal {
constructor(private verificationService: VerificationService) {}
identity(force?: boolean): Promise<any> {
return this.verificationService.getOrganizationView().toPromise().then((response ) => {
...
})
}
}
And one more service called LinkAccessService
which do the same Principal
that's not the point
And one more place is component:
export class VerificationComponent implements OnInit {
constructor(private verificationService: VerificationService) {
}
ngOnInit() {
this.verificationService.getOrganizationView()
.subscribe((data: VerificationView) => {
...
});
}
}
And at loading app moment I had 3 calls instead single request, but these entities absolutely independent and I can't share data like between components directive and so on...
How traditionally in Angular 2+ resolve issue like this? I'm not mean distinct code for answer, I mean idea.