Looking for some answers about using constants
in angularjs. Here are the constants defined in my app.js
:
... angular
.module('blocTime', ['firebase', 'ui.router'])
.config(config)
.constant('STOP_WATCH', {
"workTime": 1500,
"breakTime": 300
});
})();
I've included the constant in my directive code like this:
(function() {
function clockTimer($interval, $window, STOP_WATCH) {
return {
templateUrl: '/templates/directives/clock_timer.html',
replace: true,
restrict: 'E',
scope: {},
link: function(scope, element, attributes) {
console.log(STOP_WATCH.workTime); ...
...
angular
.module('blocTime')
.directive('clockTimer', clockTimer);
While I can successfully log the constant from within my directive, it's not showing up in the view. Here is the relevant HTML:
<div>
<div class="stop-watch">{{ STOP_WATCH.workTime }}</div>
Instead of displaying the value, it appears as undefined. Any ideas on why this might be happening and how to fix it? Thank you