0.0.1 • Published 10 years ago
repeat-brick v0.0.1
Repeat
Loop over the items of an array store and append bound instances of that element.
Repeat
is also a plugin for lego.
Installation
with component:
$ component install bredele/repeat-brick
with nodejs:
$ npm install repeat-brick
Usage
First, add the plugin to your view (see lego to know more about views):
var repeat = require('repeat-brick');
view.add('repeat', repeat(view));
Basic
<ul repeat>
<li>{{ attr }}</li>
</ul>
the 'li' is repeated for each item into the store (view is a store)
update the store :
view.reset([{
attr: 'bredele',
}, {
attr: 'Calgary'
}])
and here's the result:
<ul list>
<li>bredele</li>
<li>Calgary</li>
</ul>
See example.
License
MIT
0.0.1
10 years ago