forked from hazza/dspace-angular
dependency upgrades, server and platform module updates, linting wip
This commit is contained in:
27
src/modules/data-loader/browser-data-loader.ts
Normal file
27
src/modules/data-loader/browser-data-loader.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Http, Response } from '@angular/http';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import { DataLoader } from './data-loader';
|
||||
|
||||
@Injectable()
|
||||
export class BrowserDataLoader extends DataLoader {
|
||||
|
||||
protected prefix: string;
|
||||
|
||||
protected suffix: string;
|
||||
|
||||
constructor(private http: Http) {
|
||||
super();
|
||||
this.prefix = 'assets/data';
|
||||
this.suffix = '.json';
|
||||
}
|
||||
|
||||
public getData(name: string): Observable<any> {
|
||||
return this.http.get(`${this.prefix}/${this.language}/${name}${this.suffix}`, {}).map((response: Response) => {
|
||||
return response.json();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user