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
How are angularjs prefixes $ and $$ used?
What set of modern browsers are supported in angular 2?
What is the meaning of ng in angular 2?
What do you understand by deep linking?
what is the difference between a module’s forroot() and forchild() methods and why do you need it?
What is ng-content Directive?
What is ngrx?
What do you understand by constants in angular?
Can you explain angular js boot process?
What is ng init?
What is default scope in a angularjs directive?
How angularjs is different from jquery?
Explain what is injector in angularjs?
How can primeng be used with angular2?
How to configure angular routes?