As far as I understand the documentation, the only concrete difference between a Constant and a Value is that a Constant can be used during the apps config phase, whereas a
The difference between value and constant is that a value specified using constant is available during the configuration phase.
Well it’s the same for value and constant. constant is available from the configuration phase and value is not.
The other difference is as the name implies you can’t change the value of a constant. The first value you assign it is the value it keeps, if you try to assign it a different value later it will be ignored.
Here’s an example:
mod.value("myValue", "First Assignment");
mod.value("myValue", "Second Assignment");
mod.constant("myConstant", "First Assignment");
mod.constant("myConstant", "Second Assignment");
mod.controller("MyController", function(myValue, myConstant) {
console.log("myValue: " + myValue);
console.log("myConstant: " + myConstant);
});
Console output:
myValue: Second Assignment
myConstant: First Assignment