I can't get am- time- ago and amDateFormat of angular moment plugin to
work see the three commented out lines. I get an error on the amDateFormat
iine the other two lines I get no output. I know I have a moment field
which gets input into mongo db as a string (2016-04-30T20:18:51.718Z
)magento. Below is the moment output in the console log. Do I loose the
moment value when the form gets submitted and the datetime field inputs
into db and becomes a string OR do I have to filter the comment.datetime ?
Is it supposed to be attached to the scope instead of where I have it in
ng-model? i want to know how long its been since the comment was posted?
Seems like the plugin loads. TIA,
----
1. Moment {_isAMomentObject: true, _isUTC: false, _locale: Locale, _d: Sat
Apr 30 2016 14:04:05 GMT-0700 (PDT)}
1. _d
-----
angular.module('commentList', ['comment','momentModule'])
.directive('commentList', function () {
return {
template: '<div class="commentList">' +
'<comment-model ng-repeat="comment in comments"
author="{{comment.author}}">' +
'{{comment.msg}}' +' '+' '+
'<span style="color:blue">{{comment.date | date
}}</span>'+' '+' '+
'<span style="color:magenta">{{comment.datetime
}}</span>'+' '+' '+
// '<time style ="color:red"
am-time-ago="comment.datetime" style="color:red"> </time>'+
//'{{ comment.datetime | amDateFormat: 'h:mm a'}}'+
// '<span style="color:blue"> {{
moment("comment.datetime", "YYYYMMDD").fromNow()}}</span>'+
'</comment-model>' +
'<span ng-if="comments.length < 1">No comments yet</span>' +
'</div>',
restrict: 'E',
scope: {
comments: '='
},
link: function postLink(scope, element, attrs) {
}
};
});
--
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 https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.