Source: services/Categoria.js

    /**
     * @ngdoc service
     * @name Categoria
     * @module s4c.services.Categoria
     * 
     * @description  Componente para acesso a api do backend e/ou comunicação entre controllers
     * 
     *
     */
     
'use strict';

(function () {
	
   /**	
	* @method Categoria
	* @param {*} Base
	* @param {*} $resource
	* @param {*} API_ENDPOINT
	*/
    function Categoria($resource, API_ENDPOINT, Base) {
        var Categoria = $resource(API_ENDPOINT + 'categorias/:id', { id: '@id' }, {
            save: {
                method: 'PUT'
            },
            delete: {
                method: 'DELETE'
            },
        });

        var self = this;
        self.promise = undefined;
        Categoria.getShortCategorias = function () {

            if (self.promise) {
                return self.promise;
            }

            self.promise = Base.obter('categorias/short');
            return self.promise;
        }

        return Categoria;
    }

    angular.module('s4c.services.Categoria', [])
        .factory('Categoria', Categoria);

    Categoria.$inject = ['$resource', 'API_ENDPOINT', 'Base'];
}());