I have a service that returns an object that has a single variable, say w,
with some numeric value. I want to
build a directive that publishes that value in an HTML page. Using a link
function in the directive, I tried this:
$watch(variableService.w, numToPublish,
function(variableService.w, numToPublish) {
numToPublish = variableService.w;
element.appendChild(numToPublish);
});
but I get: Uncaught SyntaxError: Unexpected token '.'
I've also tried square brackets, as in variableService['w']. Chrome
developerTools console that the square bracket is the unexpected token.
Is there some recipe that will allow me to watch variables on a service?
Thanks
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/angular/d4f3338d-5bb9-4eb3-a144-3eb905a182d0%40googlegroups.com.