Hojendiz
Hojendiz

Reputation: 40

Dependency Injection order in AngularJS

In AngularJS, does the order of my dependencies matter?.

Example:

Suppose I have an 'awesomeGlobalService' to handle a set of services common to all the modules of my app.

Should I inject it first?:

angular.module('myModule', ['awesomeGlobalService', 'secondModule', 'anotherModule', ...])

or should I inject it last?:

angular.module('myModule', ['secondModule', 'anotherModule', ... 'awesomeGlobalService'])

or it really doesn't matter as long is in the injection array?

Upvotes: 1

Views: 677

Answers (1)

Ganesh Karamala
Ganesh Karamala

Reputation: 513

Below picture depicts the flow of life cycle when injecting dependencies:

enter image description here

Upvotes: 1

Related Questions