# Dependency Injection

# article

# scope and namespace with the angular injector

For services, angularJs injector is flat.

For constants, angularJs injector is namespaced.

Exemple, for a module structure like this :

app

app.moduleA
app.moduleA.aaaaService
app.moduleA.aaaaConstants
app.moduleA.subModuleA
app.moduleA.subaaaaModuleA

app.moduleB.bbbbService
app.moduleB.bbbbConstants
app.moduleB.subModuleB
app.moduleB.subbbbbModuleB
1
2
3
4
5
6
7
8
9
10
11
12

If you call bbbbService in aaaaService without linking the depency in moduleA module declaration, it will works. AngularJs injector is flat in that case.

If you call bbbbConstants in aaaaService without linking the dependency in moduleA module declaration, it will fail. AngularJs injector is not flat in that case.