Skip to content

Instantly share code, notes, and snippets.

@scardine
Created February 6, 2014 21:55
Show Gist options
  • Save scardine/8853272 to your computer and use it in GitHub Desktop.
Save scardine/8853272 to your computer and use it in GitHub Desktop.
Model definition for Angular+Django rest framework
// https://github.com/blacklocus/angular-django-rest-resource
angular.module('app.services', ['ngResource'], function($provide) {
$provide.factory('ModelName', function($resource) {
return djResource('/v1/model-name/pk:id/', {pk:'@id'});
});
$provide.factory('OtherModelName', function($resource) {
return djResource('/v1/other-model-name/pk:id/', {pk:'@id'});
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment