Route Based Active Class on Menu Items

When we work with multi level menus, it’s a good feature to highlight the parent item if any child item is active. With this snippet we can highlight the parent item dynamically, also the proper child items, based on the current route.