I’m building a component in Angular that controls & monitors a relay via a REST API. There are several identical relays, each with their own name and IP address.
I’m an Angular noob, and don’t quite understand the “providedIn: ‘root’ vs ‘any'” paradigm and how services are “injected”. Should I be creating a single service (shared by all instances of the component), and passing in the API endpoint each time I want to make a call to a specified API? Or should I be creating a separate instance of the service for each relay?
If the answer is the former, would it be different if the service(s) needed to keep a persistent TCP connection to each relay, instead of the stateless HTTP connections?
An am I barking up the wrong tree by looking at the “providedIn: ‘any'” business? I’ve been trying to figure out how to pass parameters (e.g. the API endpoint) into the constructor of the Service, and it seems to be surprisingly uncommon information. What am I missing?