What is difference between config() and run() method in AngularJS?
Answer Posted / 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 View All Answers
What the link function is and how it differs from compile?
What is SPA (Single Page Application) in AngularJS?
Explain the difference between angular 2 and 4?
What are major changes in angular 2?
What is ng content in angular?
What is afterviewinit?
What are post linking and pre-linking functions?
What do you know about uppercase filter and lowercase filter in angularjs?
What is cookie based authentication in angular 4?
What is pipe in networking?
Who made angular?
What is angular 5? What’s new in angular 5?
What are the differences in ngmodules and javascript modules?
What are the core dependencies of angular 7?
What is a factory?