how to create list data number 1,2,3,4,5,6,8,…
i am have code:
Template.custmerAdmin.loop = Authors.find().map(function(document, index){
document.index = index;
return document;
});
But result null
how to view list number ??
how to create list data number 1,2,3,4,5,6,8,…
i am have code:
Template.custmerAdmin.loop = Authors.find().map(function(document, index){
document.index = index;
return document;
});
But result null
how to view list number ??
Authors.find() will return a Cursor object.
You need to evaluate the cursor so you get a list to map, Authors.find().fetch().
Template.custmerAdmin.hepers({
loop: function () {
return Authors.find().fetch().map(function(document, index){
document.index = index;
return document;
})
}
});
where is result null? you are probably just using the helper wrong or so
not, u dont need fetch, .map seems ok there
still since @1.2 you can just use @index inside #each to get that info
and dont use old helper syntax.
jorgeer : Thank’s for his tutorial
Thank’s for his tutorial