diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Angular.js | 15 | ||||
| -rw-r--r-- | src/ng/location.js | 3 | 
2 files changed, 16 insertions, 2 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('&') : '';  } diff --git a/src/ng/location.js b/src/ng/location.js index 40d39282..a0f03a8e 100644 --- a/src/ng/location.js +++ b/src/ng/location.js @@ -344,7 +344,8 @@ LocationHashbangInHtml5Url.prototype =     *     * Change search part when called with parameter and return `$location`.     * -   * @param {string|object<string,string>=} search New search params - string or hash object +   * @param {string|Object.<string>|Object.<Array.<string>>} search New search params - string or hash object. Hash object +   *    may contain an array of values, which will be decoded as duplicates in the url.     * @param {string=} paramValue If `search` is a string, then `paramValue` will override only a     *    single search parameter. If the value is `null`, the parameter will be deleted.     *  | 
