I have a service that when Angular boots fetches documents and makes the available in a Map<string, Document>
.
The HttpClient
is used to fetch the documents.
Is it possible to delay the construction of the service until all the documents have been received.
In other words how can we make sure that when we constructor inject the service like this:
constructor(service:Service)
All the asynchronous operations that the service has initiated have completed such that all the documents are available?
I think this is an anti pattern and we should use RxJS, but figured I'd check.