http://docs.angularjs.org/api/ng .$httpから、トークンを含めるようにデフォルトのヘッダーを設定する必要があると書かれているので、それに従っています。
私のコードは次のようになります
var myapp = angular.module('myapp', ['ngCookies', 'ui.bootstrap']).
config(['$routeProvider', function($routeProvider, $httpProvider, $cookies){
$routeProvider.
when('/', {
templateUrl: '/partials/home.html',
controller: HomeCtrl
}).
when('/game/:gameId/shortlist/create',{
templateUrl: '/partials/create-shortlist.html',
controller: CreateShortlistCtrl
}).
otherwise({redirectTo: '/'});
}]);
myapp.run(function($rootScope, $http, $cookies, $httpProvider){
$http.get('/api/get-current-user').success(function(data){
$rootScope.current_user = data;
$rootScope.current_team = $rootScope.current_user.team;
});
$http.get('/api/get-current-season').success(function(data){
$rootScope.current_season = data;
});
$rootScope.csrf_token = $cookies.csrftoken;
console.log($httpProvider.defaults.headers.common);
//$httpProvider.defaults.headers.post['X-CSRFToken'] = $cookies.csrftoken;
});
ご覧のとおり、複数のアプローチを適用しましたが、csrf トークンでヘッダーを設定できません。私が遭遇した2つのエラーは
キャッチされないエラー: 不明なプロバイダー: $httpProviderProvider <- $httpProvider
私は何を間違っていますか?