I'm trying to export a constant in angular and I need to set a key whose value will be returned from a service. I tried with following code:
This is my user-config.ts file:
export const USER_CONFIG = {
username: new UserService().getUsername()
}
And this is my UserService file that I would like to be injected in constant:
export class UserService{
constructor(someOtherService: SomeOtherService)
getUsername() {
return this.someOtherService.getDetails('some/url')
}
}
I'm not able to work around this problem. Need help.