Package Exports
- repit
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (repit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Repeat it
Loop over the items of an array store and append bound instances of that element.
Repit has been built for brick and wall but also work as a standalone library.
Installation
with component:
$ component install bredele/repitwith browserify:
$ npm install repitStandalone
Repit uses cement to sync each item with a datastore.
HTML:
<ul>
<li>{{ label }}</li>
</ul>JavaScript:
var Store = require('datastore');
var Repeat = require('repit');
var data = new Store([{
label: 'bredele'
}, {
label: 'Calgary'
}
]);
var list = new Repeat(data);
list.scan(ul);
Result:
<ul>
<li>bredele</li>
<li>Calgary</li>
</ul>See example.
Brick
Directive:
<ul repeat>
<li>{{ label }}</li>
</ul>Brick:
var brick = require('brickjs');
var repeat = require('repit');
var view = brick(ul)
.use(repeat())
.build(); repeat will automatically use the brick data if nothing is passed.
update the ui :
view.set(0, {
label: 'something'
});
view.reset([{
label: 'bredele',
}, {
label: 'Calgary'
}])See example.
Wall
var repeat = require('repit');
var wall = require('wall');
var app = wall();
app.use(repeat);
app.repeat(node, data);See example.
License
MIT