GitHunt
KE

KEIII/NgxConfigModule

Provides Angular module to load the application configuration.

NgxConfigModule

Provides Angular module to load the application configuration.

Setup

Setup with build-in url loader:

@NgModule({
  imports: [
    HttpClientModule,
    ConfigModule.withUrl(string),
  ]
})
export class AppModule {}

Or setup with custom loader what implements ConfigLoaderInterface

@NgModule({
  imports: [
    ConfigModule.withLoader({provide: APP_CONFIG_LOADER, ...}),
  ]
})
export class AppModule {}

Now you can inject the ConfigService service into your components or services:

@Injectable()
class Service {
  constructor(configService: ConfigService<AwesomeConfig>) {
    const config: AwesomeConfig = configService.get();
    this.stuff = config.stuff;
  }
}

Languages

TypeScript100.0%

Contributors

MIT License
Created November 2, 2017
Updated March 2, 2023
KEIII/NgxConfigModule | GitHunt