Recursively using a partial in Handlebars

The examples below show how a partial can be called in itself. It is useful in creating a dynamic nested menu.

Frameworks:
jQuery 1.9.1, Handlebars 4.0.6(update)

IMPORTANT: As it is recursion, make sure that `{{#if}}` condition is correct. Otherwise it may exceed maximum call stack size and generate a RangeError.

Share