1

I have a angular application and a few modules. The modules are organized as follows:

I have two modules: helpers and maps. In the helpers module I've defined an angular filter helpers.filter(...)

The helpers module is defined as follows: var helpers = new angular.module('helpers', ['ngResource', 'ui.router']);

The other module, maps is defined as follows: var maps = new angular.module('maps', ['ngResource', 'ngSanitze']

And then there is the app module, defined like: var app = new angular.module('app', ['helpers','maps'])

How come that the filter I defined on the helpers module is available in the maps?

I assume it is because app is like a parent and the children inherit everything that is available on the parent.

Marin
  • 861
  • 1
  • 11
  • 27

1 Answers1

0

Take a look at this answer.

It's not just filters, but services, controllers, directives etc. This is because there is (normally) one $injector per app, so all modules and submodules in the app have access to the same "injectables".

Community
  • 1
  • 1
gkalpak
  • 47,844
  • 8
  • 105
  • 118