I am trying to write a function to where I can call Date.now() in the 
template as a function... {{ cliecntClock.now() | date: 'yyyy-MM-dd 
HH:mm:ss' }} and have it tick like a clock. 

Questions:
1) would there be anything wrong  with attaching a function to rootScope if 
all controllers will use it?
2) As a service, is this correct?

angular.module('monitorApp')
.factory('clockTicker', function($interval) {
    //digest to make the clock tick
    $interval(function(){ }, 1000);
    return {
            clientClock: function() { return Date; }
    }   
}); 

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to