2016-06-24 4 views
1

Ich möchte deleteMethod zu POST-Methode in NG-Admin ändern.Wie lösche ich die Delete-Methode, um die Methode in ng-admin zu posten?

Für createMethod von POST Änderungsverfahren PUT I verwendet:

user.createMethod('put'); 

I Methode, um es löschen möchten.

user.deleteMethod('post'); 

Das obige funktioniert nicht. Bitte hilf mir.

+1

Ich sehe nicht ein 'deleteMethod' überall in der Dokumentation. –

+0

@Hopeful Lama: Ja, ich versuche es einfach, aber es funktioniert nicht. –

Antwort

1

Wenn Sie ausgewählte Elemente löschen möchten, können Sie mit batchActions fortfahren und danach ein Verzeichnis mit dem gewünschten Namen erstellen und die Postanforderung bearbeiten.

.batchActions([ 
      '<batch-approvee type="confirm" selection="selection"></batch-approvee>' ]) 

Richtlinie Code:

angular.module('myApp').directive('batchApprovee',['Restangular','$q','notification','$state',function(Restangular, $q, notification, $state){ 
    return { 
     restrict: 'E', 
     scope: { 
      selection: '=', 
      type: '@' 
     }, 
     link: function(scope, element, attrs) {    
      scope.icon = attrs.type == 'accept' ? 'glyphicon-thumbs-up' : 'glyphicon-thumbs-down';    
      scope.updateStatus = function() { 
       var cItems = {};     
       var data = []; 
       var allConfirmData = scope.selection; 

       allConfirmData.forEach(function(confirmItem,index){ 
        cItems.id = confirmItem._identifierValue; 
        cItems.status = 2;     
        data.push(cItems); 
        cItems = {}; 
       }); 
       var config = { 
        headers : { 
         'Content-Type': 'application/json;' 
        } 
       } 
       notification.getBatchApproval(data,config).then(
        function(res){ 
         if(res&&res.data){ 
          alert("Inventory Confirmed"); 
         } 
        }, 
        function(err){ 
         alert(err); 
        }) 
      } 
     }, 
     template: ` <span ng-click="updateStatus()"><span class="glyphicon {{ icon }}" aria-hidden="true"></span>&nbsp;Confirm</span>` 
    };