Patch-Anfrage mit anglejs

Ich arbeite an einer API, die Djang-Tastypie als Backend und AngularJs als Frontend verwendet. Ich sende eine Anfrage für CRUD mit anglejs $ http. GET, POST, PUT alles ist in Ordnung, aber wenn ich versuche, eine PATCH-Anfrage zu senden, ist ein Fehler aufgetreten. Methode PATCH ist nicht definiert. Ich habe eine Fabrik von API-Aufrufen im Winkel erstellt, aber die PATCH-Anforderung funktioniert dort nicht.

angular.module('tastypieModule', ['ngResource']).
factory('apiCall', function($http, $resource) {

    delete $http.defaults.headers.common['X-Requested-With'];

    var apiCall = $resource('/api/v1/:type/:id/',
        {type: '@type', username: '@userName', api_key: '@api_key', user: '@userID', id: '@id'},
        {
            get: {method: 'GET'},
            post: {method: 'POST', headers: {'Content-Type': 'application/json'}},
            del: {method: 'DELETE', headers: {'Content-Type': 'application/json'}},
            update: {method: 'PUT', headers: {'Content-Type': 'application/json'}},
            pupdate:{method:'PATCH',headers: {'Content-Type': 'application/json'}}
        }
    );

 return apiCall;
});  
 function MyCtrl($scope,$resource){
$scope.edit=function(){
   id=$scope.E_id
    $http.pupdate('/api/v1/quizsetting/'+id+'/', editedquizsetting).
    success(function(data, status) {
        $scope.status = status;
        $scope.data = data;
        $scope.editQuizSettingModal = false;
        //$scope.quizsettinglist.objects[$scope.e_quizsettingindex]=data;
        $(".message").append("object has been created successfully");
    })
    .
     error(function(data, status) {
        $scope.data = data || "Request failed";
        $scope.status = status;        
    });
};
}

Das ist mein HTML-Code

<div ng-app="myApp">
<div ng-controller="MyCtrl">
<button type="button" ng-click="edit()">Edit</button>
</div></div>

Wenn ich eine Pfadanforderung mit diesem Code in der Konsole sende, wird angezeigt, dass http.patch keine Funktion ist. Sagen Sie mir, wie kann ich ng-app und services so konfigurieren, dass eine PATCH-Anfrage mit anglejs gesendet wird.

Antworten auf die Frage(1)

Ihre Antwort auf die Frage