mirror of
https://github.com/fergalmoran/dss.web.git
synced 2026-02-16 04:55:11 +00:00
16 lines
547 B
JavaScript
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();
|
|
}
|
|
}
|
|
});
|