Angularjs PATCH - undefined is not a function

I am trying to use the angular $ http.patch () function to call the URl API As recommended by these answers - 1 and 2 I set the Content-Type headers in the / json application in config.

But still I get the error:

undefined is not a function

Am I missing something? Below is my code where the error occurs (Note: I entered $ http in my service in my service and other methods GET, POST, PUT, DELETE work fine):

deleteAll: function (data) { // custom service function
                url = $rootScope.config.api.stack.add_stack;                
                return $http.patch(url,angular.toJson(data)); // error thrown here in firebug
            }

AngularJs Version: v1.2.16

Even I tried using the latest version of angularjs, but still didn’t bite

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
+4
source share
2 answers

$http . $http

$http({ method: 'PATCH', url: url, data: angular.toJson(data));

: .

+13
+8

All Articles