Search code examples
meteormeteor-blaze

Why Template.body.helper data is not visible to a child template?


I have several templates in my main.html as depicted below. I realised that Template.body.helper({aglobal: return aGlobal}) is not visible in parent templates (like navbarTemplate below). When I define the "aglobal" helper fucntion inside a parent template I can access it in the HTML without a problem. What is the problem here?

  <body>
        {{>navbarTemplate}}
        {{>editingUsers}}

    <div class="container">
            <div class="row">
                <div class="col-md-6">
                    <p>Editor</p>
                    {{>editor}}
                </div>
                <div class="col-md-6">
                    <p>Viewer</p>
                    {{>viewer}}
                </div>
            </div>
        </div>
    </body>

Solution

  • @Giova.panasiti That wasn't the exact answer that I was looking for but I find the answer in the doc you shared, thanks.

    The answer seems to be very simple; "Helpers on Template.body are only available in the tags of your app. To register a global helper, use Template.registerHelper." -- http://blazejs.org/api/templates.html#Template-body