ajax呼び出しが開始されるたびに、$rootScopeでイベントを発生させようとしています。
var App = angular.module('MyApp');
App.config(function ($httpProvider) {
//add a transformRequest to preprocess request
$httpProvider.defaults.transformRequest.push(function () {
//resolving $rootScope manually since it's not possible to resolve instances in config blocks
var $rootScope = angular.injector(['ng']).get('$rootScope');
$rootScope.$broadcast('httpCallStarted');
var $log = angular.injector(['ng']).get('$log');
$log.log('httpCallStarted');
});
});
イベント「httpCallStarted」は発生していません。構成ブロックで$rootScopeまたはその他のインスタンスサービスを使用するのは正しくないと思います。もしそうなら、私が電話をかけるたびに設定オブジェクトを渡す必要なしに、http呼び出しが始まるたびにイベントを取得するにはどうすればよいですか?
前もって感謝します