2.0.9 • Published 6 years ago
bdt105angularconfigurationservice v2.0.9
Angular Configuration Service
Principle
Allows to read a configuration file before the angular app starts
Dependencies
bdt105toolbox (https://github.com/bdt105/modules/tree/master/toolbox)
Installation
In your app.module.ts insert
import { ConfigurationService } from 'bdt105angularconfigurationservice';
import { NgModule, APP_INITIALIZER } from '@angular/core';
...
export function init (config: ConfigurationService) {
config.load();
return () => {
return config.load(); // add return
};
}
@NgModule({
declarations: [
],
imports: [
],
providers: [
{
'provide': APP_INITIALIZER,
'useFactory': init,
'deps': [ ConfigurationService ],
'multi': true
},
ConfigurationService
],
bootstrap: [AppComponent]
});
...
providers: [ ConfigurationService ];
Into your component
import { ConfigurationService } from 'bdt105angularconfigurationservice';
...
constructor(private configurationService: ConfigurationService) {}
public getConfigurationBackgroungColor(){
let conf = this.configurationService.get();
return conf.backgroundColor;
}
2.0.9
6 years ago
2.0.8
6 years ago
2.0.7
6 years ago
2.0.6
6 years ago
2.0.5
6 years ago
2.0.4
6 years ago
2.0.3
6 years ago
2.0.2
6 years ago
2.0.1
6 years ago
2.0.0
6 years ago
1.0.9
6 years ago
1.0.8
6 years ago
1.0.7
6 years ago
1.0.6
6 years ago
1.0.5
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago