vinoth vinoth - 2 years ago 139
AngularJS Question

Difference between constant and value in angular js

What is difference between constant and value. we can able to change both variable values.

var app = angular.module(‘myApp’,[]);
app.constant(‘appName’,‘My App’);

Answer Source

Constants can put anywhere whereas Values cannot be added anywhere. Also constants cannot be intercepted by decorators whereas values can be intercepted by decorators.

Also refer: Value and Constants

The difference between a value and a constant service is that the former can only be injected (and thus be used) in a service or a controller while the latter can also be injected into a module configuration function.. (I will discuss the module configuration function in a future post).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download