P
P
pavtaras2015-12-24 14:51:16
JavaScript
pavtaras, 2015-12-24 14:51:16

What is the initialization order in AngularJS?

Is there anywhere to read about the order of initialization in AngularJS. I mean the complete list, where the order of initialization is clearly clear. For example,

  1. filter
  2. run
  3. service
  4. controller

etc., only in more detail and preferably with a link

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-12-24
@pavtaras

Mmmm... everything is initialized on demand and asynchronously. That is, services are initialized on demand, if you inject them into controllers, then naturally they are initialized before the controller (since these are their dependencies). Filters are initialized after template compilation, and only those that are used there.
run is run first, there is a configuration phase before run.
With all the complexities, you just shouldn't tie the application to this whole thing (and that's a good idea). You have a configuration phase where you can do something else with the dependency container, for example, configure services, and then that's it ... only run is executed first (and if it requires services, they are initialized first) then imagine that you don't know the order, etc. d.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question