Angularjs corner filter not firing
I have the following filter:
'use strict';
angular.module('app')
.filter('fromNow', function() {
return function(date) {
return moment(date).fromNow();
}
});
which I am trying to use here:
<div class="streamline b-l m-b" style="margin-top: 25px;">
<div class="sl-item b-{{activity.module.module_type.color.substr(activity.module.module_type.color.indexOf('-')+1,activity.module.module_type.color.length )}} b-l" ng-repeat="activity in activities">
<div class="m-l">
<div class="text-muted">{{activity.timestamp | filter:fromNow}}</div>
<p>{{activity.module.name}}: {{activity.module.module_type_id == 1 ? 'Gennemfรธrt' : activity.score}}</p>
</div>
</div>
</div>
however nothing is started.
What am I doing wrong?
+3
source to share
1 answer
filter
is already an Angular filter. Might be confusing as it is named filter
, but yes there is a filterfilter
.
You just want to use your own named filter: {{activity.timestamp | fromNow}}
+4
source to share