Handlebars: Is there a way to output a full object that is part of an array (with "each")? -


Then it's my data set I want pass the handle bar:

  handlar Templates .test (events: events, foo1: foo1, foo2: foo2}); Focus will be on the "Event: Event" 
"Wrong">
  events = [{bla1:" John w ", bla2:" 14 : 00 "}, // This is an event {bla1:" Jason's ", bla2:" 18: 00 "} // And this is an event)  

and it is test.handlebars

  {{# every event}} & lt; Div data-event = "{{this}}" & gt; & Lt; --- Here I am the complete object (event) & lt; Div & gt; {{This.bla1}} & lt; / Div & gt; I want to include. & Lt; Div & gt; {{This.bla2}} & lt; / Div & gt; & Lt; / Div & gt; {{/ Every}}  

How do I pass the whole event as an object of data-event Can i I tried it with {{this}} (like above), but it failed for me

OK I finally found a solution:

  var Events [i] Event_string = JSON.stringify (events [i]); Events = [{bla1: "John W", bla2: "14:00", Event_string: Event_string}, ...  

  & lt; Div data-event = "{{this.Event_string}}">  


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -