What is difference between config() and run() method in AngularJS?



What is difference between config() and run() method in AngularJS?..

Answer / chaitanya

Configuration block – This block is executed during the provider registration and configuration phase. Only providers and constants can be injected into configuration blocks. This block is used to inject module wise configuration settings to prevent accidental instantiation of services before they have been fully configured. This block is created using config() method.

Run block – This block is executed after the configuration block. It is used to inject instances and constants. This block is created using run() method. This method is like as main method in C or C++. The run block is a great place to put event handlers that need to be executed at the root level for the application. For example, authentication handlers.

Is This Answer Correct ?    54 Yes 3 No

Post New Answer

More AngularJS Interview Questions

What is routing in angular?

0 Answers  


Tell me which browsers does Angular work with?

0 Answers  


Is angular modules and es modules are the same?

0 Answers  


What are services in javascript?

0 Answers  


Explain the architecture of angular 2?

0 Answers  


Explain lowercase filter.

0 Answers  


What are the symbols used in one way and two ways data binding?

0 Answers  


What is service factory?

0 Answers  


How do you check if I have angular cli installed?

0 Answers  


What are the possible ways to bind component properties to an associated template?

0 Answers  


If both factory and service are equivalent, then when should I use them?

0 Answers  


What is "track by" in angularjs and how does it work?

0 Answers  


Categories