javascript - How do I implement condition for last item with #each block in Meteor? -
i've upgraded meteor app 0.8.0 , handlebars custom helpers have stopped working, helper allows me alter behaviour when last item appended on list, know how can handlebars helper working again or how can functionality working latest version of meteor, thanks!
helper code (original link)
handlebars.registerhelper("foreach", function(arr, options){ if(options.inverse && !arr.length) return options.inverse(this); return arr.map(function(item, index){ item.$index = index; item.$first = index === 0; item.$last = index === arr.length - 1; return options.fn(item); }).join(''); });
meteor has migrated handlebars namespace ui
ui.registerhelper("foreach", function(arr, options){ return arr.map(function(item, index){ item.$index = index; item.$first = index === 0; item.$last = index === arr.length - 1; return options.fn(item); }).join(''); });
Comments
Post a Comment