May 16, 2015

Add active state on meteor.js menu

Imaging you have already created a menu in meteor js framework, somewhere in your header, something like this

SO you want to make the menu to be active when you are on current route, one of the simple solution is to create a template helper, Register a template helper by adding a file on client folder called helper.js

then inside helper.js register a template helper (Template.registerHelper), which previously called UI.registerHelper.


with this helper, you can add to your template.



now your li class will return active when you are on that page/route.