0

At the bottom of Angular's Dependency Injection guide, I came across this snippet about factory methods, and I'm having a hard time understanding where the "depProvider" and "depService" are being defined:

Here's the snippet:

  angular.module('myModule', []).
  config(['depProvider', function(depProvider){
    ...
  }]).
  factory('serviceId', ['depService', function(depService) {
    ...
  }]).
  directive('directiveName', ['depService', function(depService) {
    ...
  }]).
  filter('filterName', ['depService', function(depService) {
    ...
  }]).
  run(['depService', function(depService) {
    ...
  }]);

Am I correct in that 'depProvider' and 'depService' are injected into these definitions, and would have to be defined elsewhere? Or are these built-in dependencies?

2 Answers 2

1

I assume that those are fictional modules that should show you how a factory (or anything else) could *dep*end on another service.

They are no built-in modules or anything.

Sign up to request clarification or add additional context in comments.

Comments

1

Yes, you're right. That dependencies can be in the same module or in any module declared as a dependency (modules can have dependencies too).

For what it's worth every Angular built-in service starts with a $ so they are easily spotted (e.g. $scope, $http, $timeout etc).

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.