Created
February 27, 2013 17:18
-
-
Save pyykkis/5049695 to your computer and use it in GitHub Desktop.
Append and prepend for transparency.js
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
/* | |
<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