Skip to content

Instantly share code, notes, and snippets.

@bebraw
Created March 29, 2013 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bebraw/5271770 to your computer and use it in GitHub Desktop.
Save bebraw/5271770 to your computer and use it in GitHub Desktop.
var context, directives;
context = {
"header": "Colors",
"items": [
{"name": "red", "first": true, "url": "#Red"},
{"name": "green", "link": true, "url": "#Green"},
{"name": "blue", "link": true, "url": "#Blue"}
],
"empty": false
};
directives = {
items: {
name: {
href: function() {
return this.url;
},
html: function() {
if(this.first) {
return '<strong>' + this.name + '</strong>';
}
}
}
}
};
$('.container').render(context, directives);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment