Skip to content

Instantly share code, notes, and snippets.

@blackjid
Created October 6, 2015 23:39
Show Gist options
  • Save blackjid/d1eb60243a62e35c1725 to your computer and use it in GitHub Desktop.
Save blackjid/d1eb60243a62e35c1725 to your computer and use it in GitHub Desktop.
Rootless Ams Style for Restmod
angular.module('restmod').factory('RootlessAMSApi', ['restmod', 'inflector', function(restmod, inflector) {
return restmod.mixin({ // include default packer extension
$config: {
style: 'AMS',
primaryKey: 'id',
jsonMeta: 'meta',
jsonLinks: 'links'
},
$extend: {
// special snakecase to camelcase renaming
Model: {
decodeName: inflector.camelize,
encodeName: function(_v) { return inflector.parameterize(_v, '_'); }
}
}
});
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment