joemfb / ml-common-ng

An angular module of common components for the MarkLogic REST API
https://joemfb.github.io/ml-common-ng/
2 stars 2 forks source link

Add support for deleteCollection and deleteDirectory #27

Open grtjn opened 7 years ago

grtjn commented 7 years ago

I'm currently doing it like:

    ctrl.clearData = function() {
      $http({
        url: '/v1/search',
        method: 'DELETE',
        params: {
          collection: 'data'
        }
      }).then(function(response) {
        toast.success('Deleted');
        $scope.$broadcast('refresh');
      }, function(response) {
        toast.danger(response.data);
      });
    };

but being able to leverage mlRest.deleteCollection('data').then(...) or such would be nicer..

grtjn commented 7 years ago

Fun extra, make them accept arrays too, and do a promise.all to wait for all to finish..

sashamitrovich commented 7 years ago

+1