Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions 1.4.9/angular-resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand All @@ -636,7 +641,7 @@ angular.module('ngResource', ['ng']).

value.$resolved = true;

response.resource = value;
response.resource = (action.transformResult)? transformedValue : value;

return response;
}, function(response) {
Expand Down