…Defining templates in Handlebars is pretty similar to defining templates in Mustache…and again, that's because Handlebars is a super set of the Mustache library.…So, just like in Mustache, we have a…script tag and that script tag will contain.…The HTML definition for the template.…The only real difference is that…the type attribute is set to text/x-handlebars-template…and we give it an id, just as we've done in the past.…But beyond that, it's pretty much the same thing.…
So here I have my HTML code and it uses the double brace syntax,…you can see there, to define the…placeholders where the data will be filled in.…So, if I have my data.…And it looks like this, field1, 2, and 3, you can see that the placeholders…in the template match up with the data…field names, just like they do in Mustache.…Now, rendering Handlebars Templates is slightly…different although it follows the same pattern.…So, in the first step, we get the…innerHTML content of the template that we have defined.…So, I'm using the trick here to get the script tag…
- What is templating?
- Defining templates in jQuery Template
- Using simple Mustache templates with sections and conditions
- Adding conditionals and loops to Handlebars templates
- Working with Dust templates
Skill Level Intermediate
What is templating?5m 12s
2. jQuery Template
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.