Can anyone tell me what I might be doing wrong. I have this code:
var app = angular.module('app',
[
'angular-cache',
'angular-loading-bar',
'ngAnimate',
'ngCookies',
'pascalprecht.translate',
'ui.router',
'ui.bootstrap'
])
app.config([
'$httpProvider',
'$q',
($httpProvider,
$q) => {
$httpProvider.interceptors.push(
function () {
return {
'request': function (config) {
return config;
},
// optional method
'requestError': function (rejection) {
return $q.reject(rejection);
},
// optional method
'response': function (response) {
return response;
},
// optional method
'responseError': function (rejection) {
return $q.reject(rejection);
}
}
})
}])
When it runs I am getting the message:
Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to: Error: [$injector:unpr] Unknown provider: $q http://errors.angularjs.org/1.5.0/$injector/unpr?p0=%24q at http://localhost:1828/lib/angular/angular.js:68:12 at http://localhost:1828/lib/angular/angular.js:4397:19 at getService (http://localhost:1828/lib/angular/angular.js:4550:39) at injectionArgs (http://localhost:1828/lib/angular/angular.js:4574:58) at Object.invoke (http://localhost:1828/lib/angular/angular.js:4596:18) at runInvokeQueue (http://localhost:1828/lib/angular/angular.js:4497:35) at http://localhost:1828/lib/angular/angular.js:4506:11 at forEach (http://localhost:1828/lib/angular/angular.js:321:20) at loadModules (http://localhost:1828/lib/angular/angular.js:4487:5) at createInjector (http://localhost:1828/lib/angular/angular.js:4409:19) http://errors.angularjs.org/1.5.0/$injector/modulerr?p0=app&p1=Error%3A%20%…%20(http%3A%2F%2Flocalhost%3A1828%2Flib%2Fangular%2Fangular.js%3A4409%3A19)
When I comment out all this code and run my application it works and I don't get this error message.