0

Now can anyone explain that how I can use these custom methods? I know about the basic methods of resource and how to use them but this thing is confusing.

app.factory('ResouceService', ['$resource', '$window',

    function($resource, $window) {

        return {
            request: function($url) {
                return $resource($url + ':id', {}, {
                    query: {
                        method: 'POST',
                        data: {},
                        isArray: false
                    },
                    get: {
                        method: 'GET'
                    },
                    remove: {
                        method: 'DELETE'
                    },
                    edit: {
                        method: 'POST',
                        data: {},
                        isArray: false
                    },
                    add: {
                        method: 'PUT',
                        data: {},
                        isArray: false
                    }
                });
            }
        }

    }
]);
nikoshr
  • 32,926
  • 33
  • 91
  • 105

1 Answers1

0

Use your factory method in your controller

app.controller('customerController', function($scope, ResouceService) {
                $scope.myMethods = ResouceService;
            });
Jiman Sahariah
  • 110
  • 1
  • 11