diff options
| author | Matias Niemelä | 2013-12-06 13:08:46 -0500 | 
|---|---|---|
| committer | Matias Niemelä | 2013-12-06 13:13:48 -0500 | 
| commit | 3602c9785b70707edbfcb15eaee4bc4d1258ab89 (patch) | |
| tree | 5343272e7b45e0bbb9faccb00f3e496976f84a37 /src/ngResource | |
| parent | acaac21fd175254b23d0f8a3b736c18a92873564 (diff) | |
| download | angular.js-3602c9785b70707edbfcb15eaee4bc4d1258ab89.tar.bz2 | |
revert: chore($resource): Use shallow copy instead of angular.copy
Diffstat (limited to 'src/ngResource')
| -rw-r--r-- | src/ngResource/resource.js | 25 | 
1 files changed, 3 insertions, 22 deletions
| diff --git a/src/ngResource/resource.js b/src/ngResource/resource.js index 8e63c4e8..e2499864 100644 --- a/src/ngResource/resource.js +++ b/src/ngResource/resource.js @@ -25,25 +25,6 @@ function lookupDottedPath(obj, path) {  }  /** - * Create a shallow copy of an object and clear other fields from the destination - */ -function shallowClearAndCopy(src, dst) { -  dst = dst || {}; - -  angular.forEach(dst, function(value, key){ -    delete dst[key]; -  }); - -  for (var key in src) { -    if (src.hasOwnProperty(key) && key.substr(0, 2) !== '$$') { -      dst[key] = src[key]; -    } -  } - -  return dst; -} - -/**   * @ngdoc overview   * @name ngResource   * @description @@ -412,7 +393,7 @@ angular.module('ngResource', ['ng']).        }        function Resource(value){ -        shallowClearAndCopy(value || {}, this); +        copy(value || {}, this);        }        forEach(actions, function(action, name) { @@ -484,7 +465,7 @@ angular.module('ngResource', ['ng']).              if (data) {                // Need to convert action.isArray to boolean in case it is undefined                // jshint -W018 -              if (angular.isArray(data) !== (!!action.isArray)) { +              if ( angular.isArray(data) !== (!!action.isArray) ) {                  throw $resourceMinErr('badcfg', 'Error in resource configuration. Expected ' +                    'response to contain an {0} but got an {1}',                    action.isArray?'array':'object', angular.isArray(data)?'array':'object'); @@ -496,7 +477,7 @@ angular.module('ngResource', ['ng']).                    value.push(new Resource(item));                  });                } else { -                shallowClearAndCopy(data, value); +                copy(data, value);                  value.$promise = promise;                }              } | 
