aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng
diff options
context:
space:
mode:
authorIgor Minar2013-08-01 09:34:56 -0700
committerIgor Minar2013-08-01 09:34:56 -0700
commit9c53d0769e045c76c29a18b6e2ff9709b3338a48 (patch)
treeed559ec73c0aadd5702beae7ea339d678a574e41 /src/ng
parent90532f5e3c2016c99833a4dd779a5c4718c84f4d (diff)
downloadangular.js-9c53d0769e045c76c29a18b6e2ff9709b3338a48.tar.bz2
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.
Diffstat (limited to 'src/ng')
-rw-r--r--src/ng/location.js29
1 files changed, 11 insertions, 18 deletions
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();