I've set up a separate module to contain an api service, and I'm trying to inject it into my routing configuration. But I get the above error. Here's the relevant code:
/***********
* app module
************/
(function(){
'use strict';
angular
.module('app', [
/***************
* Vendor modules
****************/
'ui.router',
'ngCookies',
'ngSanitize',
/***************
* Custom modules
****************/
'app.auth',
'app.debates',
'app.api'
]);
})();
/***********
* api module
************/
(function(){
'use strict';
angular
.module('app.api', []);
})();
/************
* api service
************/
(function(){
'use strict';
angular
.module('app.api')
.constant('API_BASE_URL', 'http://localhost:8000/api/')
.service('Api', Api);
Api.$inject = ['$http', 'API_BASE_URL'];
function Api($http, API_BASE_URL){
var service = {
getDebates: getDebates
};
return service;
/* ********************************
* Method: getDebates
******************************** */
function getDebates() {
var request = {
method: 'GET',
url: API_BASE_URL + 'debates',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
};
return $http(request);
}
} // function Api
})();
Then in my route configuration on the main app
module, I'm pulling in the Api service in order to use it in the resolve methods of each state:
(function(){
'use strict';
angular
.module('app')
.config(routes);
routes.$inject = ['$stateProvider', '$urlRouterProvider', '$locationProvider', '$httpProvider', 'Api'];
function routes($stateProvider, $urlRouterProvider, $locationProvider, $httpProvider, Api) {
I'm sure there's something simple I've missed, but I can't find it.