This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Query params not serializes as expected #3740
Closed
Description
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
?arr=1&arr=2&arr=3
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.
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