diff options
author | Danijel Anđelković <adanijel99@gmail.com> | 2022-04-23 01:28:46 +0200 |
---|---|---|
committer | Danijel Anđelković <adanijel99@gmail.com> | 2022-04-23 01:28:46 +0200 |
commit | 1177f4b29b616a59af39f4aef11b116f9660357d (patch) | |
tree | 36aaa26c5b78a2a5de9d86c6cde299b25f348091 /frontend/src/app/_services/configuration.service.ts | |
parent | c8165d451b295ec610702b36fc05b8cc6047497b (diff) |
Reorganizovao stranice i komponente.
Diffstat (limited to 'frontend/src/app/_services/configuration.service.ts')
-rw-r--r-- | frontend/src/app/_services/configuration.service.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/frontend/src/app/_services/configuration.service.ts b/frontend/src/app/_services/configuration.service.ts new file mode 100644 index 00000000..cda1091a --- /dev/null +++ b/frontend/src/app/_services/configuration.service.ts @@ -0,0 +1,20 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { IConfig } from '../_data/IConfig' + +@Injectable() +export class Configuration { + static settings: IConfig; + constructor(private http: HttpClient) { } + load() { + const jsonFile = 'assets/config.json'; + return new Promise<void>((resolve, reject) => { + this.http.get(jsonFile).toPromise().then((response) => { + Configuration.settings = <IConfig>response; + resolve(); + }).catch((response: any) => { + reject(`Could not load file '${jsonFile}': ${JSON.stringify(response)}`); + }); + }); + } +}
\ No newline at end of file |