Set configuration correctly
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
This commit is contained in:
parent
d5258b7c79
commit
7476e4c928
@ -1,4 +1,5 @@
|
|||||||
import {Inject, Injectable} from '@angular/core';
|
import {Inject, Injectable} from '@angular/core';
|
||||||
|
import { Location } from '@angular/common';
|
||||||
import {HttpClient, HttpXhrBackend} from '@angular/common/http';
|
import {HttpClient, HttpXhrBackend} from '@angular/common/http';
|
||||||
import {Observable} from 'rxjs';
|
import {Observable} from 'rxjs';
|
||||||
|
|
||||||
@ -8,7 +9,7 @@ export class AppConfig {
|
|||||||
private config: Object = null;
|
private config: Object = null;
|
||||||
private httpClient: HttpClient;
|
private httpClient: HttpClient;
|
||||||
|
|
||||||
constructor(xhrBackend: HttpXhrBackend) {
|
constructor(xhrBackend: HttpXhrBackend,private location:Location) {
|
||||||
this.httpClient = new HttpClient(xhrBackend);
|
this.httpClient = new HttpClient(xhrBackend);
|
||||||
this.config = null;
|
this.config = null;
|
||||||
}
|
}
|
||||||
@ -21,7 +22,7 @@ export class AppConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public load(): Promise<any> {
|
public load(): Promise<any> {
|
||||||
return this.httpClient.get('/configuration.json')
|
return this.httpClient.get(this.location.prepareExternalUrl('/configuration.json'))
|
||||||
.toPromise()
|
.toPromise()
|
||||||
.then(data => {
|
.then(data => {
|
||||||
this.config = data;
|
this.config = data;
|
||||||
|
Loading…
Reference in New Issue
Block a user