1

I want to change deleteMethod to POST method in ng-admin.

For changing createMethod from POST to PUT method I used:

user.createMethod('put');

I want to delete to post method.

user.deleteMethod('post');

The above is not working. Please help me.

Hopeful Llama
  • 728
  • 5
  • 26
Ravi Kadia
  • 275
  • 1
  • 2
  • 9

1 Answers1

1

if you want to delete selected items then you can go with batchActions and after that create a directory with the name you want and hit the post request.

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

directive 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>`
    };