These are some examples of the Backbone Directives being used.
The binding are declared as directives on the html itself and the view becomes a live view.
Source code is on GitHub and read the blog post about it
Updates the text of an element based on the model's attributes. Expressions are also evaluated.
Usage:
<span bb-bind="counter"></span>
<span bb-bind="counter * 2"></span>
<span bb-bind="counter % 2 == 0 ? 'even' : 'odd'"></span>
Example:
- +
Let's double it:
It is an number
Add/Removes a class based on the model's attributes. Expressions are also evaluated.
Binds an attribute to an input element.
<input bb-model="name">
My name is !
Checkbox The checkbox is .
First Second Third The radio button is .
Show/Hides the element based on the model's attributes. Expressions are also evaluated.
Binds an image's source to the model's attributes using a template form.
I'd love to talk about this over at Twitter: @ketacode