this is the model I pass to my handlebars template
module.exports = function(showHeader, userId){ // the data model
  return {
    userId: userId,
    seminars: userSeminars;
  };
};
var userSeminars = [{ // some information
    seminarId: 1,
    isRated: true
}, {
    seminarId: 2,
    isRated: false
}];
and when rendering my template I use this HTML code
{{#each seminars}}
    <div class="seminarContainer">
        {{#if isRated}}
            <button onclick="loadStatistics({{seminarId}}, {{userId}})">Do Something 1</button>
        {{else}}
            <button onclick="loadQuestionnaire({{seminarId}})">Do Something 2</button>
        {{/if}}
    </div>
{{/each}}
but when debugging, {{userId}} is undefined. I went for this test routine and write it above the each-loop
$(document).ready(function () {
   alert({{userId}}); // this works
});
userId is not undefined. But when iterating over the array it is undefined. How can I leave the array scope within the loop? I would have to access the data model object, not an attribute in the array.
EDIT
Access a variable outside the scope of a Handlebars.js each loop
When I want to leave the scope I can use {{../userId}} 
Within the loop
<p>{{../userId}}</p>
works fine but when using this for parameters like
onclick="loadStatistics({{seminarId}}, {{../userId}})"
the second parameter is undefined.
 
     
    
{{../userId}}
` it works – Question3r Dec 26 '17 at 19:40