My recommendation is the following, if you have the config file is a json you can make a get to it using the HTTPClient library of angular, after capturing the data you want you can create an Observer, BehaviorSubject, or whatever you feel more comfortable, in which you set the variable where you store the url, that way you can have the url accessible throughout the application
for example create service to get configFile
@Injectable({providedIn: 'root'})
export class ConfigLoaderService{
constructor(private http: HttpClient) {}
getConfigFile(): Observable<HttpResponse<any>> {
return this.http.get<any>(`` + '/asset/config.json', { observe: 'response'});
}
}
then yo can use this class in injecting in constructor
Hope help you, Regards
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…