diff --git a/1.4.9/angular-resource.js b/1.4.9/angular-resource.js index 8e74b012b..43a328126 100644 --- a/1.4.9/angular-resource.js +++ b/1.4.9/angular-resource.js @@ -615,8 +615,13 @@ angular.module('ngResource', ['ng']). 'contain an {1} but got an {2} (Request: {3} {4})', name, action.isArray ? 'array' : 'object', angular.isArray(data) ? 'array' : 'object', httpConfig.method, httpConfig.url); } + + var transformedValue = null; // jshint +W018 - if (action.isArray) { + //If user provide transformResult function, returns user needed results + if(action.transformResult){ + transformedValue = action.transformResult(data); + } else if (action.isArray) { value.length = 0; forEach(data, function(item) { if (typeof item === "object") { @@ -636,7 +641,7 @@ angular.module('ngResource', ['ng']). value.$resolved = true; - response.resource = value; + response.resource = (action.transformResult)? transformedValue : value; return response; }, function(response) {