From 9c53d0769e045c76c29a18b6e2ff9709b3338a48 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 1 Aug 2013 09:34:56 -0700 Subject: revert: fix(location): fix parameter handling on search() This reverts commit 90532f5e3c2016c99833a4dd779a5c4718c84f4d. The commit contains references to minErr that are not available in the stable branch. --- src/ng/location.js | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/ng/location.js b/src/ng/location.js index 9ec6300f..e99137d5 100644 --- a/src/ng/location.js +++ b/src/ng/location.js @@ -349,24 +349,17 @@ LocationUrl.prototype = { * @return {string} search */ search: function(search, paramValue) { - switch (arguments.length) { - case 0: - return this.$$search; - case 1: - if (isString(search)) { - this.$$search = parseKeyValue(search); - } else if (isObject(search)) { - this.$$search = search; - } else { - throw $locationMinErr('wpt', 'First parameter of function must be string or an object.'); - } - break; - default: - if (paramValue == undefined || paramValue == null) { - delete this.$$search[search]; - } else { - this.$$search[search] = paramValue; - } + if (isUndefined(search)) + return this.$$search; + + if (isDefined(paramValue)) { + if (paramValue === null) { + delete this.$$search[search]; + } else { + this.$$search[search] = paramValue; + } + } else { + this.$$search = isString(search) ? parseKeyValue(search) : search; } this.$$compose(); -- cgit v1.2.3