You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
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.