here I need a suggestion or better approach related to multi URL consumption scenario: I have a JSON file in assets folder where it contains multiple URLs like below
{
"Url1": "http://dummy.restapiexample.com/",
"Url2": "https://reqres.com"
"url3": "https://fakeapi.com"
}
with using environment.ts or without environment.ts I need to consume these URLs and
how I trying to consume is
consuming a json file to --> config.service.ts -->Setting.service.ts(where each url will have differnt methods basing on url it will call that method) --> dataLayer.service.ts --> some.component.ts
JSON --> config.service.ts (where it loads the json file) config.service.ts --> settings.service.ts (where it choose which url to be called )
ex:
public x(){
return url1
}
public y(){
return url2
}
like above based on a call from dataLayer.service.ts it calls some diff methods
in settings.service.ts --> dataLayer.service.ts
here it calls settings methods like
public Method1(){
this.settings.x()
}
and this data layer is called using some.compoent.ts
this.datalayer.method1.susbscribe(res => {res})
so my point is how can I implement injection token scenario or APP_INITIALIZER