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?