reactive-child
v0.0.1
Published
Create child views for properties
Downloads
11
Readme
reactive-child
Plugin for reactive to create child views for properties. Adds a child
binding.
Usage
child([bindings])
- Extend bindings
or create a
new bindings object.
<section>
<article child="book.metadata">
<h1>{title} by {author}</h1>
</article>
</section>
var reactive = require('reactive')
, child = require('reactive-child')
var model = {
book: {
metadata: {
title: 'Siddhartha',
author: 'Hermann Hesse'
}
}
}
reactive(template, model, {
bindings: child()
})
Or if you want a different binding name:
reactive(template, model, {
bindings: { 'model': child.binding }
})
Note that the element itself becomes the root node of the child view:
<article child="book.metadata" data-title="{title}"></article>
Install
npm i reactive-child
Then bundle for the browser with browserify.