How to show index for an array in loop in the template of Meteor?
Show indexing in template of Meteor for a list of array in loop
You can use something like this:
Like you have a template name home.html with home template name
Now you can write this code for indexing or index to show listing
home.js
var tot = 0;
Template.home.helpers({
listIndex: function(num){
tot = tot+num;
return tot;
}
});
Template.home.destroyed = function(){
tot = 0;
};
Now you can call this function from your template
home.html
like this:
{{listIndex 1}}
Hope this will work for you :)
You can use something like this:
Like you have a template name home.html with home template name
Now you can write this code for indexing or index to show listing
home.js
var tot = 0;
Template.home.helpers({
listIndex: function(num){
tot = tot+num;
return tot;
}
});
Template.home.destroyed = function(){
tot = 0;
};
Now you can call this function from your template
home.html
like this:
{{listIndex 1}}
Hope this will work for you :)
Comments
Post a Comment