Reputation: 639
I've setup an angular seed project with some services and a factory. companyService
depends on a factory called company. Injecting company into companyService
fails with this error. I can't seem to figure out what I'm doing wrong.
var module = angular.module('project.services', []);
module.factory('company', ['$rootScope', 'Resource', function($rootScope, $resource){
return $resource($rootScope.api + 'companies/:id');
}]);
module.service('companyService',['$rootScope', '$http', 'company', function($rootScope, $http, company){
var companies;
//var $injector = angular.injector();
//var company = $injector.get('company');
// some more functions ....
}]);
Upvotes: 0
Views: 65
Reputation: 48211
ngResource
is a separate module, so you should include the angular-resource[.min].js
script and declare ngResource
as a dependency of your app:
angular.module('myApp', [..., 'ngResource']);
Upvotes: 1