3
votes

I have data in json format just like in the following way.

var json={time:"10",temp:"20",attributeValue:valueWillchangeDynamically}

handleBars Template:

 <input type="text" value="{{unitValue2}}">

what I want,

If attributeValue equals to time, my handlebars template should be like

 <input type="text" value="{{time}}">

If attributeValue equals to temp, my handlebars template should be like

 <input type="text" value="{{temp}}">

that means, I want to pass attribute name also dynamically.

please can anyone help me.

Thanks.

1

1 Answers

0
votes

The way forward for you might be to write a Handlebars helper function which will check for the condition equality and manipulate your template accordingly.

Check out the helpers section here