Runtime, reactive configuration handler for Angular
Find a file
2025-07-17 18:45:06 +02:00
.vscode initial commit 2022-07-14 23:43:13 +02:00
projects/reactive-config Update Angular version 2025-07-17 18:45:06 +02:00
.editorconfig Update to angular v15 2023-02-12 23:02:49 +01:00
.eslintrc.json Update to angular v15 2023-02-12 23:02:49 +01:00
.gitignore initial commit 2022-07-14 23:43:13 +02:00
.prettierrc Update to angular v15 2023-02-12 23:02:49 +01:00
angular.json Update to Angular V16 2023-05-20 19:56:54 +02:00
jest.config.js Update to angular v15 2023-02-12 23:02:49 +01:00
LICENSE Update to v18 2024-06-15 19:16:12 +02:00
package-lock.json Update Angular version 2025-07-17 18:45:06 +02:00
package.json Update Angular version 2025-07-17 18:45:06 +02:00
README.md Merge branch 'master' of github.com:deejayy/reactive-config 2022-07-15 20:04:14 +02:00
tsconfig.json Update to angular v15 2023-02-12 23:02:49 +01:00

npm

Runtime Reactive Configuration Handler for Angular

Install

npm i @deejayy/reactive-config

Define your configuration type

export class ConfigVars {
  public apiUrl!: string;
}

Add module to imports

imports: [
  ...
  ReactiveConfigModule.forRoot(ConfigVars, { configPath: '/assets/config-new.json' }),
],

Create configuration file with the fields defined in your type

/assets/config-new.json:

{
  "apiUrl": "http://localhost"
}

Use the config values from anywhere

Static variable: {{ apiUrl }}
Reactive variable: {{ apiUrl$ | async }}
public apiUrl: string = this.config.get('apiUrl'); // gets the latest value statically
public apiUrl$: Observable<string> = this.config.getStream('apiUrl'); // get values reactively with streams

constructor (private config: ReactiveConfigService<ConfigVars>) {}

Update the values runtime

<button (click)="updateVar()">change</button>
public updateVar() {
  this.config.set('apiUrl', 'new value');
}