diff options
| author | Misko Hevery | 2010-05-10 10:36:06 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-05-10 10:36:06 -0700 |
| commit | f5027cc375cf29d8a78679297d9f6bdca9567eb7 (patch) | |
| tree | f415af2b615656562c1d1ac10fe9b4aab83b54c7 /src/Resource.js | |
| parent | 4542716370ac52f385795f509436104a2a3501d2 (diff) | |
| parent | 664f1c56876f00b885272c39f759641271eef1dc (diff) | |
| download | angular.js-f5027cc375cf29d8a78679297d9f6bdca9567eb7.tar.bz2 | |
Merge branch 'master' of github.com:angular/angular.js
Diffstat (limited to 'src/Resource.js')
| -rw-r--r-- | src/Resource.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Resource.js b/src/Resource.js index 34ad1c5d..c9bad0c0 100644 --- a/src/Resource.js +++ b/src/Resource.js @@ -21,7 +21,7 @@ Route.prototype = { }); url = url.replace(/\/?#$/, ''); var query = []; - foreach(params, function(value, key){ + foreachSorted(params, function(value, key){ if (!self.urlParams[key]) { query.push(encodeURI(key) + '=' + encodeURI(value)); } @@ -69,14 +69,18 @@ ResourceFactory.prototype = { switch(arguments.length) { case 3: callback = a3; case 2: - if (typeof a2 == 'function') { + if (isFunction(a2)) { callback = a2; } else { params = a1; data = a2; break; } - case 1: if (isPost) data = a1; else params = a1; break; + case 1: + if (isFunction(a1)) callback = a1; + else if (isPost) data = a1; + else params = a1; + break; case 0: break; default: throw "Expected between 0-3 arguments [params, data, callback], got " + arguments.length + " arguments."; @@ -109,7 +113,7 @@ ResourceFactory.prototype = { case 1: if (typeof a1 == 'function') callback = a1; else params = a1; case 0: break; default: - throw "Expected between 1-3 arguments [params, data, callback], got " + arguments.length + " arguments."; + throw "Expected between 1-2 arguments [params, callback], got " + arguments.length + " arguments."; } var self = this; Resource[name](params, this, function(response){ |
