Is it possible to assign a parameter value within handlebars templates without using helpers?

I needed this solution solved in the same way the original poster expected. Therefore I created a helper function to do this for me.

function setVariable(varName, varValue, options){
  options.data.root[varName] = varValue;
};

Contained within the options in the helper, is the data block, with the root of the helper variables.

I placed my variable within the root object, either assigning or overwriting with the value provided.

The helper in html looks a lot like this.

{{setVariable "thisVar" "Contents Here"}}

<div>
  {{thisVar}}
</div>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)