Angular serializes query strings in a particular way that many backend frameworks (including Rails) don't understand. jQuery param on the other hand has been the standard for this for years.
Example 1
var params = {
arr: [1,2,3]
}
Angular serializes to
Jquery.param serializes to
arr%5B%5D=1&arr%5B%5D=2&arr%5B%5D=3
// which is equivalent to
// arr[]=1&arr[]=2&arr[]=3
Example 2
var params = {
obj: {
foo: 1
}
}
Angular serializes to:
obj=%7B%22foo%22:1%7D
// equivalent to
// obj={"foo":1}
jQuery.param serializes to
obj%5Bfoo%5D=1
// which is eq to
// obj[foo]=1
There are several closed issues related to this, but this seems to be a common problem, jquery.param looks likes the expected behaviour.
#1363
#3121
#1640
Some of the conversation on these issues seems to imply that this has been done, but I tested this using Angular 1.2 with the same results as before.
Please lets consider making Angular serialization equivalent to jQuery.param
Thanks