I have a service named HeaderService(header.service.ts) which takes URL as a constructor parameter and has method getManifest which returns a JSON. Now, the JSON has an array of URLs. I have to hit those URLs and getManifest for them. Now, for each corresponding URL, I was planning to create a seperate HeaderService instance and then call getManifest but it turns out Angular 6 doesn't provide that functionality (I come from Java background and I was thinking a bit like in Java). So, how do I create instances of HeaderService dynamically? Note that I cannot do it at the time of injection and hence the factory option seems to be not useful here to me.
Also, I would prefer not to change the code of HeaderService as it is generated use Swagger CodeGen and second, I writing a getManifest(URL: string) in some other class (say, service.util.module.ts) will cause code duplication.
Note: I have referred to previously posted questions (like this one) but they discuss how to create multiple instances at the time of injection. My case is different.