Skip to content

Instantly share code, notes, and snippets.

@vojtajina
Created October 21, 2013 17:13
Show Gist options
  • Save vojtajina/7087392 to your computer and use it in GitHub Desktop.
Save vojtajina/7087392 to your computer and use it in GitHub Desktop.
if (action.isArray) {
if (!angular.isArray(data)) {
throw $resourceMinErr('badcfg', 'Error in resource configuration. Expected response to contain an array but got an object');
}
value.length = 0;
forEach(data, function(item) {
value.push(new Resource(item));
});
} else {
if (angular.isArray(data)) {
throw $resourceMinErr('badcfg', 'Error in resource configuration. Expected response to contain an object but got an array');
}
copy(data, value);
value.$promise = promise;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment