Skip to content

Instantly share code, notes, and snippets.

@pyykkis
Created February 27, 2013 17:18
Show Gist options
  • Save pyykkis/5049695 to your computer and use it in GitHub Desktop.
Save pyykkis/5049695 to your computer and use it in GitHub Desktop.
Append and prepend for transparency.js
/*
<div class="template">
<div class="todo"></div>
<div>
*/
data = [
{todo: "foo", done: false},
{todo: "bar", done: true}
];
// Add `append` and `prepend` to options
$('.template').render(data, {
todo: {
class: function(context){return context.value + ' ' + this.done}
}
},{
debug: true,
method: 'append'
});
// or move directives as a part of `options` hash
$('.template').render(data, {
debug: true,
method: 'append',
directives: {
todo: {
class: function(context){return context.value + ' ' + this.done}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment