I have a span in ng-repeat as follows:
span(humanize-date="{{file.date}}"
I'm to create a directive so that, directive changes the date format
directive('humanizeDate', [
function() {
return {
restrict: 'EA',
template: '<div value="{{formattedDate}}"/>',
replace: true,
scope: {
formattedDate: '=humanizeDate'
},
link: function(scope, elem, attrs) {
return scope.formatedDate = moment.duration(scope.humanizeDate).humanize();
}
};
}
]);