bruth / synapse

Hooks to support data binding between virtually any object.
http://bruth.github.com/synapse/docs/
BSD 2-Clause "Simplified" License
150 stars 6 forks source link

Add support for interfacing with a template or DOM fragment #3

Open bruth opened 12 years ago

bruth commented 12 years ago

Currently only one binding can be setup at a time, but it would be very useful to something like:

template = '<div class="book">
    <h1 role="title"></h1>
    <em role="author"></em>
    <p role="summary"></p>
 </div>'

fragment = $(template)

model = new Backbone.Model
    title: 'Secrets of a JavaScript Ninja'
    author: 'John Resig'
    summary: 'Learn to be a true JavaScript ninja like John..'

fragment.observe model
alanchrt commented 11 years ago

This would be a great next step. If it could stay de-coupled from the template engine and allow somehow for both DOM (Angular/rivets-style) and string templates (Handlebars, Underscore, etc), it would be truly amazing.