Last active
August 29, 2015 13:57
-
-
Save SerkOw/9767138 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var studentsTemplate ='<script id="students-template" type="text/x-handlebars-template"><table><thead><th>Student Name</th><th>Special Skill</th><th>Email</th></thead><tbody>{{#students}}<tr><td>{{name}}</td><td>{{specialskill}}</td><td>{{email}}</td></tr>{{/students}}</tbody></table></script>'; | |
$(".content").append(studentsTemplate); | |
var studentTemplateScript = $("#students-template").html(); | |
var theStudentTemplate = Handlebars.compile(studentTemplateScript); | |
var data = { students: [ | |
{name: "Goku", specialskill: "Spirit Bomb", email: "[email protected]" }, | |
{name: "Gohan", specialskill: "Masenko", email: "[email protected]" }, | |
{name: "Vegeta", specialskill: "Great Ape", email: "[email protected]"} | |
]}; | |
$(".info").append(theStudentTemplate(data)); | |
var assignmentsTemplate ='<script id="assignments-template" type="text/x-handlebars-template"><table><thead><th>Week</th><th>Readings</th><th>Assignments</th></thead><tbody>{{#assignments}}<tr><td>{{week}}</td><td>{{read}}</td><td>{{assignment}}</td></tr>{{/assignments}}</tbody></table></script>'; | |
$(".content").append(assignmentsTemplate); | |
var assignmentTemplateScript = $("#assignments-template").html(); | |
var theAssignmentTemplate = Handlebars.compile(assignmentTemplateScript); | |
var datatwo = { assignments: [ | |
{week: "One", read: "About Bears and Katz", assignment: "Eat, Pray, Code" }, | |
{week: "Two", read: "Something about Data Storage and Javascript", assignment: "Eat More, Pray More, Code More" }, | |
]}; | |
$(".info").append(theAssignmentTemplate(datatwo)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment