From 16f3f9db90ae505758ddbe275444b026bfeb3e17 Mon Sep 17 00:00:00 2001 From: Stanislav Komanec Date: Sun, 23 Aug 2015 20:06:17 +0200 Subject: [PATCH] fix(ngResource): canceling XHR request using promise - refactor --- src/ngResource/resource.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/ngResource/resource.js b/src/ngResource/resource.js index 46642157db20..07a11c49fcdc 100644 --- a/src/ngResource/resource.js +++ b/src/ngResource/resource.js @@ -568,10 +568,17 @@ angular.module('ngResource', ['ng']). undefined; forEach(action, function(value, key) { - if (key != 'params' && key != 'isArray' && key != 'interceptor' && key != 'timeout') { - httpConfig[key] = copy(value); - } else if (key == 'timeout') { - httpConfig[key] = value; + switch (key) { + default: + httpConfig[key] = copy(value); + break; + case 'params': + case 'isArray': + case 'interceptor': + break; + case 'timeout': + httpConfig[key] = value; + break; } });