Set configuration correctly
FarmMaps.Develop/FarmMapsLib/develop This commit looks good Details

pull/1/head
Willem Dantuma 2019-11-11 17:38:49 +01:00
parent d5258b7c79
commit 7476e4c928
1 changed files with 3 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import {Inject, Injectable} from '@angular/core';
import { Location } from '@angular/common';
import {HttpClient, HttpXhrBackend} from '@angular/common/http';
import {Observable} from 'rxjs';
@ -8,7 +9,7 @@ export class AppConfig {
private config: Object = null;
private httpClient: HttpClient;
constructor(xhrBackend: HttpXhrBackend) {
constructor(xhrBackend: HttpXhrBackend,private location:Location) {
this.httpClient = new HttpClient(xhrBackend);
this.config = null;
}
@ -21,7 +22,7 @@ export class AppConfig {
}
public load(): Promise<any> {
return this.httpClient.get('/configuration.json')
return this.httpClient.get(this.location.prepareExternalUrl('/configuration.json'))
.toPromise()
.then(data => {
this.config = data;