2016-06-24 2 views
1

ng-admin에서 deleteMethod을 POST 방법으로 변경하고 싶습니다.ng-admin에서 메소드를 삭제하기 위해 delete 메소드를 변경하는 방법은 무엇입니까?

방법을 넣어 POST에서 createMethod 변경을 위해 내가 사용 :

user.createMethod('put'); 

내가 방법을 게시 삭제할.

user.deleteMethod('post'); 

위의 코드는 작동하지 않습니다. 도와주세요.

+1

나는 어디서나 문서에서'deleteMethod' 표시되지 않습니다. –

+0

@Hopeful Llama : 예. 그냥 시도해 보지만 일하지는 않습니다. 다른 생각은 없나요? –

답변

1

선택한 항목을 삭제하려면 batchActions로 이동 한 다음 원하는 이름의 디렉토리를 만들고 게시 요청을 누르십시오.

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

지시어 코드 :

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>` 
    }; 
관련 문제