AngularJs query data Sending object to the filter

1

I have a WS written in Spring that takes an object as a filter and returns a list of data.

in my Java Service:

@ResponseBody
@RequestMapping(value="/{filtro}",method=RequestMethod.GET)
public Datatable listar(@RequestBody PessoaFiltro filtro) throws Exception {
    /*Codigo não importante omitido aqui*/
}

in my Angular Service JS:

angular.module('datatablePessoaFactory', ['ngResource'])
.factory('datatablePessoaService', function($resource) {
    var recurso = $resource('/datatable-pessoa/:filtro', {filtro:'@filtro'}, 
            {'update': { method:'PUT'}
        }
    );
    return recurso;
}

);

the call in the JS controller:

datatablePessoaService.get({'filtro':vm.filtro},
function(dados){
    vm.datatablePessoas = dados;
},            
function(erro){
    console.log(erro);
}

);

However, I can not make the query because, as far as I can tell, the GET method does not accept the passing of complex objects.

and I see the error in my console:

  

datatable-person /% 5Bobject% 20Object% 5D Failed to load resource: the server responded with a status of 405 (Method Not Allowed)

Then my question is: How can I make a query where it is necessary to pass a complex object?

    
asked by anonymous 11.08.2017 / 20:10

0 answers