blob: 45431d4b287f7da9180296eec2187b858dcdb5b9 [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>> {
19 return this.resource = this.$resource(`${AppConfig.apiEndpoint}${url}`);
20 }
21}