I have been having problems rendering a template function call from a meteor/angular template. I am trying to use the Moment.js package to format my time stamp. I have seen examples of this done with Blaze however, I can't replicate it in Meteor with Angular. My issue is with the formatTimestamp() function call. It isn't rendering anything and there are no errors in my console. Where am I going wrong?
My template
<li ng-repeat="task in $ctrl.tasks" ng-class="{'private' : task.private}">
<details>
<summary>{{task.administration.inventoryNumber}}</summary>
<ul class="bxslider">
<li><h3>Adminstration</h3>
<table>
<td>created at: </td><td>{{formatTimestamp(task.administration.createdAt)}}</td>
My controller
class TodosListCtrl {
constructor($scope) {
$scope.viewModel(this);
this.subscribe('tasks');
this.helpers({
tasks() {
const selector = {};
return Artefacts.find(selector, {
sort: {
createdAt: -1
}
});
},
currentUser() {
return Meteor.user();
},
formatTimestamp: function (timestamp) {
alert("timestamp");
console.log(timestamp);
return moment(timestamp).calendar();
}
})
}
Insert Mongo function
Artefacts.insert({
administration: {
inventoryNumber: invNum,
boxNumber: boxNum,
createdAt: new Date(),