Matteo Scandolo | f2c3ed6 | 2016-12-15 14:32:50 -0800 | [diff] [blame] | 1 | import {AppConfig} from '../../config/app.config'; |
| 2 | |
| 3 | export interface IXosResourceService { |
| 4 | getResource(url: string): ng.resource.IResourceClass<any>; |
| 5 | } |
| 6 | |
| 7 | export 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 Scandolo | 6e5da16 | 2016-12-23 09:11:04 -0800 | [diff] [blame] | 19 | return this.resource = this.$resource(`${AppConfig.apiEndpoint}${url}/:id/`, {id: '@id'}); |
Matteo Scandolo | f2c3ed6 | 2016-12-15 14:32:50 -0800 | [diff] [blame] | 20 | } |
| 21 | } |