Skip to content

Instantly share code, notes, and snippets.

@charlesjolley
Created September 7, 2010 19:29
Show Gist options
  • Save charlesjolley/568908 to your computer and use it in GitHub Desktop.
Save charlesjolley/568908 to your computer and use it in GitHub Desktop.
contact = HandlebarsView.create({
template: "<h1>{firstName} {lastName}</h1><br><h2>{emailAddress}</h2>"
});
--
// AUTOMATICALLY observes properties referenced in the template
contact.set('firstName', 'John');
contact.set('lastName', 'Doe');
contact.set('emailAddress', 'john@example.com');
---
contact.get('renderedTemplate'):
> '<h1>John Doe</h1><br><h2>john@example.com</h2>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment