Skip to content

Instantly share code, notes, and snippets.

View snowgooseyk's full-sized avatar

snowgooseyk snowgooseyk

View GitHub Profile
@snowgooseyk
snowgooseyk / emulateHTTP.coffee
Last active August 29, 2015 14:09
Equivalent of Backbone#emulateHTTP on AngularJS
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
}