I'm currently using Angular 13 and attempting to connect with Angular's bootstrapping phase through the APP_INITIALIZER token. I need to create an Angular service that manages the retrieval of our remote configuration. However, I've run into an issue where promises are no longer supported and have been deprecated. Can someone provide guidance on how to refactor the loadAppConfig() method since APP_INITIALIZER only works with promises? Any assistance would be greatly appreciated.
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable()
export class AppConfigService {
private appConfig;
constructor(private http: HttpClient) { }
loadAppConfig() {
return this.http.get('/assets/data/appConfig.json')
.toPromise()
.then(data => {
this.appConfig = data;
});
}
getConfig() {
return this.appConfig;
}
}