How to pass array parameter to AngularJS $resource -


when pass array resource action.. doesn't convert array parameter array of url parameters

var product = $resource('path/products'); product.query({ids: [1,2,3]}) 

instead of getting:

path/products?ids[]=1&ids[]=2ids[]=3 

i'm getting:

path/products?ids=1&ids=2ids=3 

anyone knows how around issue?

you can use $resource pass array

var searchrequest = $resource('/api/search/post', {}, {     'get': {method: 'get'} }); searchrequest.get({'ids[]':[1,2,3]}); 

then request url

/api/search/post?ids%5b%5d=1&ids%5b%5d=2&ids%5b%5d=3 

you %5b%5d instead of []

and if expect return array instead of object should use

'get': {method: 'get', isarray: true} 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -