blob: 51e41d3d9a8d5efa200da0a43279235f9dc37443 [file] [log] [blame]
Matteo Scandolof2c3ed62016-12-15 14:32:50 -08001import {AppConfig} from '../../config/app.config';
2
3export interface IXosResourceService {
4 getResource(url: string): ng.resource.IResourceClass<any>;
5}
6
7export class ModelRest implements IXosResourceService {
8 static $inject = ['$resource'];
9 private resource: angular.resource.IResourceClass<any>;
10
11 /** @ngInject */
12 constructor(
13 private $resource: ng.resource.IResourceService
14 ) {
15
16 }
17
18 public getResource(url: string): ng.resource.IResourceClass<ng.resource.IResource<any>> {
Matteo Scandolo6e5da162016-12-23 09:11:04 -080019 return this.resource = this.$resource(`${AppConfig.apiEndpoint}${url}/:id/`, {id: '@id'});
Matteo Scandolof2c3ed62016-12-15 14:32:50 -080020 }
21}