私はインターセプターの基本的なサンプルを使用しようとしているので、小さなコードをじっと見つめましたが、成功しませんでした:
var app = angular.module('app',[]).
config(['$routeProvider','$locationProvider', function($routeProvider,$location) {
$routeProvider.
when('/home', {templateUrl: 'home.html', controller: homeCtrl}).
when('/login', {templateUrl: 'login.html', controller: loginController}).
otherwise({redirectTo : '/home' });
}]);
app.config(function ($httpProvider) {
$httpProvider.interceptors.push('httpRequestInterceptor');
});
インデックス ページを起動すると、コンソールにエラー メッセージが表示されます。
Uncaught TypeError: Cannot call method 'push' of undefined from app
何か案が?
ありがとう