Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.factory('ServiceResource', ['$resource', 'authorization', 'baseServiceUrl', function($resource, authorization, baseServiceUrl) {
- var headers = authorization.getAuthorizationHeader();
- var ServiceResource = $resource(baseServiceUrl + '/api/service/:id', null, {
- 'public': { method: 'GET', isArray: true },
- 'byId': { method: 'GET', params: { id: '@id' }, isArray: false, headers: headers }
- });
- return {
- public: function() {
- return ServiceResource.public();
- },
- byId: function(id) {
- return ServiceResource.byId({id: id});
- }
- }
- }]);
- app.controller('Ctrl', ['$scope', 'ServiceResource', function($scope, ServiceResource) {
- $scope.data = ServiceResource.public();
- }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement