Is .value() the proper way to set app-wide constant and how to retrieve it in a controller?



Is .value() the proper way to set app-wide constant and how to retrieve it in a controller?..

Answer / Mukesh Kumar

Yes, you can use the $injector service's .value() method to set constants at the application level. To retrieve the constant in a controller, inject the $injector service, call its .get() method, and pass the constant's name as an argument.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More AngularJS Interview Questions

What is package json in angular?

1 Answers  


How do components communicate with each other?

1 Answers  


What are the advantages of token-based authentication?

1 Answers  


What is ng-cloak directive and why we use?

1 Answers  


Can we use the open-source closure library with angular?

1 Answers  


What is an angular 2 service?

1 Answers  


What is ivy rendering engine in angular 7?

1 Answers  


Explain the functionality angular.copy() method?

1 Answers  


What is scope in angular?

1 Answers  


In angular, describe how will you set, get and clear cookies?

1 Answers  


Why is mvc used?

1 Answers  


Does Angular use the jQuery library?

1 Answers  


Categories