Created
October 6, 2015 23:39
-
-
Save blackjid/d1eb60243a62e35c1725 to your computer and use it in GitHub Desktop.
Rootless Ams Style for Restmod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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