6

There are

  • controllers
  • constants
  • directives
  • services
  • factory
  • run
  • config
  • filters

functions of angular.js. What is the calling order of all these modules?

2
  • check this example fiddle.jshell.net/afluegge/apo91559/light Commented Jul 14, 2016 at 12:28
  • 1
    Put 3 console.logs and find out yourself? Commented Jul 14, 2016 at 12:29

1 Answer 1

16

Learning this I made a fiddle observing the behaviour by console.log. Its like

  • app config
  • app run
  • directive setup
  • directive compile
  • (app controller dependencies)
    • service
    • factory
    • inner factory
    • inner service
  • app controller
  • filter
  • directive linking
  • filter render (w.r.t the markup)

Observe yourself here (Check Console).

EDIT

New Fiddle with filters added

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

10 Comments

and filters place?
@SunilGarg Please check the updated answer. I've added a filter too.
thanks! but if i am injecting filter in the controller then the filter will get loaded first. Same with the service, if inject service in run then this will get loaded before run method.
Yes basically after directive compile the controllers dependencies are loaded and then the services factories filters get loaded w.r.t the dependencies which are injected in the controller.
Just to add: App Constant Providers, App Value Providers are executed in same order before App config is executed
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.