leaf-framework
Version:
Light Everis Angular Frontend Framework
23 lines • 707 B
JavaScript
import 'rxjs/add/operator/map';
var JsonFileService = /** @class */ (function () {
function JsonFileService(http) {
this.http = http;
}
/**
* Load the data defined in the json file
*/
JsonFileService.prototype.getData = function () {
return this.http.get(this.getFilePath()).map(this.extractData);
};
/**
* Extract data that arrives from the response
* @param res the response
*/
JsonFileService.prototype.extractData = function (res) {
var body = res.json() || {};
return body.data || body;
};
return JsonFileService;
}());
export { JsonFileService };
//# sourceMappingURL=json-file.service.js.map