From c0de8fb737d5d381e1ca5efc58c9ce5fcd860dd9 Mon Sep 17 00:00:00 2001 From: Adrian Gheorghe Date: Sun, 23 Sep 2012 01:53:08 +0200 Subject: fix($resource): prevent default params to be shared between actions Having a $resource defined as: var R = $resource('/Path', {}, { get: {method: 'GET', params: {objId: '1'}}, perform: {method: 'GET'} }); was causing both actions to call the same URI (if called in this order): R.get({}); // => /Path?objId=1 R.perform({}); // => /Path?objId=1 --- src/ngResource/resource.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ngResource/resource.js b/src/ngResource/resource.js index 4bd845f0..5e58737e 100644 --- a/src/ngResource/resource.js +++ b/src/ngResource/resource.js @@ -313,8 +313,8 @@ angular.module('ngResource', ['ng']). function extractParams(data, actionParams){ var ids = {}; - paramDefaults = extend(paramDefaults, actionParams); - forEach(paramDefaults || {}, function(value, key){ + actionParams = extend({}, paramDefaults, actionParams); + forEach(actionParams, function(value, key){ ids[key] = value.charAt && value.charAt(0) == '@' ? getter(data, value.substr(1)) : value; }); return ids; -- cgit v1.2.3