Skip to content

Instantly share code, notes, and snippets.

@dylanz
Created July 6, 2012 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dylanz/3062339 to your computer and use it in GitHub Desktop.
Save dylanz/3062339 to your computer and use it in GitHub Desktop.
Angular $resource
$http({
method: action.method,
url: route.url(extend({}, extractParams(data), action.params || {}, params)),
data: data
}).then(function(response) {
var data = response.data;
//****
// I can get the status code here from response.status
//****
if (data) {
if (action.isArray) {
value.length = 0;
forEach(data, function(item) {
value.push(new Resource(item));
});
} else {
copy(data, value);
}
}
(success||noop)(value, response.headers);
}, error);
return value;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment