aboutsummaryrefslogtreecommitdiffstats
path: root/src/Angular.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/Angular.js')
-rw-r--r--src/Angular.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/Angular.js b/src/Angular.js
index 5caf4665..c1066618 100644
--- a/src/Angular.js
+++ b/src/Angular.js
@@ -850,7 +850,14 @@ function parseKeyValue(/**string*/keyValue) {
key_value = keyValue.split('=');
key = tryDecodeURIComponent(key_value[0]);
if ( isDefined(key) ) {
- obj[key] = isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true;
+ var val = isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true;
+ if (!obj[key]) {
+ obj[key] = val;
+ } else if(isArray(obj[key])) {
+ obj[key].push(val);
+ } else {
+ obj[key] = [obj[key],val];
+ }
}
}
});
@@ -860,7 +867,13 @@ function parseKeyValue(/**string*/keyValue) {
function toKeyValue(obj) {
var parts = [];
forEach(obj, function(value, key) {
+ if (isArray(value)) {
+ forEach(value, function(arrayValue) {
+ parts.push(encodeUriQuery(key, true) + (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true)));
+ });
+ } else {
parts.push(encodeUriQuery(key, true) + (value === true ? '' : '=' + encodeUriQuery(value, true)));
+ }
});
return parts.length ? parts.join('&') : '';
}