How to make #invoke inside of #define in xamin handlebars.php

I have to create a recursion of #define. How to do recursion in handlebars.php

{{#define render_menu}}
        <li>
            {{label}}
            {{#if submenu}}
                <ul>
                    {{#each submenu}}
                            {{#invoke render_menu}}
                    {{/each}}
                </ul>

            {{/if}}
        </li>
    {{/define}}

Should be called in the .tmpl file and should invoke the above code.

    <ul>
        {{#each menu}}
            {{#invoke render_menu}}
        {{/each}}
    </ul>

Read more here: How to make #invoke inside of #define in xamin handlebars.php

Leave a Reply

Your email address will not be published. Required fields are marked *