I am trying to use a basic interceptor pattern, so I looked with a small piece of code, but to no avail:
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'); });
When I launch my index page, an error message appears in the console:
Uncaught TypeError: Cannot call method 'push' of undefined from app
Any idea?
thanks
angularjs
Fred merit
source share