Here are the lines I have:
var app = angular.module('app', []);
app.constant("const", {
foo: "bar",
test: "123"
});
I am trying to access the information in constant
directly from the module app
. However, this approach did not work:
console.log(app.constant.const.foo);
I am aware that you can inject constants into controllers, services, etc. to access the information. But for my specific needs, I want to access them directly from the module.
Is it true that the only way to access a registered constant
is by injecting it into a controller/service, etc.?