Files
dss.web/client/app/directives/misc/timeAgo.js
Fergal Moran d2c529bafe Screw you git!
2015-12-01 19:50:20 +00:00

16 lines
547 B
JavaScript

'use strict';
angular.module('dssWebApp')
.directive('timeAgo', function (TimedNotificationService) {
return {
template: '<span>{{timeAgo}}</span>',
replace: true,
link: function (scope, element, attrs) {
var updateTime = function () {
scope.timeAgo = moment(scope.$eval(attrs.timeAgo)).fromNow();
};
TimedNotificationService.onTimeAgo(scope, updateTime); // subscribe
updateTime();
}
}
});