Skip to content

Instantly share code, notes, and snippets.

@ChrisLTD
Created March 30, 2014 23:55
Show Gist options
  • Save ChrisLTD/9882153 to your computer and use it in GitHub Desktop.
Save ChrisLTD/9882153 to your computer and use it in GitHub Desktop.
Making angular app POST and GET ajax work with Rails
@app = angular.module('MyApp',[]);
@app.config ($httpProvider) ->
authToken = $("meta[name=\"csrf-token\"]").attr("content")
$httpProvider.defaults.headers.common["X-CSRF-TOKEN"] = authToken
$httpProvider.defaults.headers.common['Accept'] = "application/json"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment