I can't seem to figure out what's missing here. I hope it's just a minor issue.
The problem I'm facing is that the APP_INITIALIZER isn't resolving completely.
In my code, I have two services: AppSettingsService and SomethingService. I've introduced a new injectable token called "API_BASE_URL" that I want to inject into SomethingService. AppSettingsService has a method named setup() which sets the string "test" within a Promise. My intention is for this promise to be resolved before setting API_BASE_URL. However, it appears that the code doesn't want to wait for it!
I've included a sandbox link:
If you open the console and observe, these are the steps it follows:
"Executing promise" (this is as expected) "Getting test string too early" (I would expect this after the promise resolves) "undefined" (this occurs because I'm trying to print appSettings.test but it hasn't been set yet due to the unresolved Promise) "Resolving promise" (this happens shortly thereafter due to the setTimeout())
Any assistance would be greatly appreciated!