Do you know why the '<span am-time-ago="comment.dateCreated"></span>'+
doesn't work? I'm not sure this part should be in the link funciton but
scope.message = {
text: 'hello world!',
time: new Date()
};
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}}' +' '+' '+
'{{comment.dateCreated | date: "MM-dd-yyyy"}}
'+' '+' '+
'<span am-time-ago="comment.dateCreated"></span>'+
'</comment-model>' +
'<span ng-if="comments.length < 1">No comments yet</span>' +
'</div>',
restrict: 'E',
scope: {
comments: '='
},
link: function postLink(scope, element, attrs) {
scope.message = {
text: 'hello world!',
time: new Date()
};
}
};
});
On Monday, April 25, 2016 at 9:28:17 PM UTC-7, Sander Elias wrote:
>
> Your factory is called 'moment', so inject that, and not '$windows.moment'
> .
>
>
>
--
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.