Last active
August 29, 2015 14:09
-
-
Save snowgooseyk/45c74565b25d78e89387 to your computer and use it in GitHub Desktop.
Equivalent of Backbone#emulateHTTP on AngularJS
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('App',[]) | |
.factory('emulateHttpInterceptor', ($q) -> | |
{ | |
request: (config) -> | |
method = config.method.toUpperCase() | |
if method in ['DELETE','PUT'] | |
config.method = 'POST' | |
config.headers['X-HTTP-Method-Override'] = method | |
config | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment