angularjs - How to send an array of parameter through GET with Restangular -
i have send array of filters through parameters in api :
/mylist?filters[nickname]=test&filters[status]=foo
now if send object directly :
restangular.one('mylist').get({filters: { nickname: 'test', status: 'foo' }});
the query sent
?filters={"nickname":"test","status":"foo"}
how send real array ? should thinks alternative ?
i found way it, have iterate on filter object create new object [] in name :
var query = {}; (var in filters) { query['filters['+i+']'] = filters[i]; } restangular.one('mylist').get(query);
produce:
&filters%5bnickname%5d=test
someone have better solution ?
Comments
Post a Comment