reactive-child

0.0.1 • Public • Published

reactive-child

Build Status NPM dependencies

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.

License

MIT © Vincent Weevers

Package Sidebar

Install

npm i reactive-child

Weekly Downloads

0

Version

0.0.1

License

MIT

Last publish

Collaborators

  • vweevers