0

I am using the APP_INITIALIZER with useFactory for the configuration file to load environment properties as json file during the run time. It works and I can access the properties in different components and services using following code:

public propsConfiguration: PropsConfiguration;

constructor(
    private ConfigService: ConfigService,
    ...
) {
  this.propsConfiguration = this.configService.getConfiguration();
  this.urlAdd = this.propsConfiguration.propertyName;
}
....
....

My issue is that I cannot access the properties in this way in some other classes such: department.model.ts which is actually just a model class with a constructor and one method. Have been trying couple of options but didn't help. How can I access the properties in such classes? Any Idea or hint please?

k.vincent
  • 3,743
  • 8
  • 37
  • 74
  • This is your solution here https://stackoverflow.com/questions/41432388/how-to-inject-service-into-class-not-component – navnath Sep 22 '21 at 14:38
  • 1
    @navnath: indeed. The answer from: Kilves did the fix. Don't know how to add here as an answer. Aynway, the issue is fixed with option from Kilves in the question/link you posted. – k.vincent Sep 24 '21 at 13:36

0 Answers0