An open API service indexing awesome lists of open source software.

https://github.com/dundalek/bindem

A light-weight library providing Knockout-like two-way declarative data binding for Backbone.
https://github.com/dundalek/bindem

Last synced: about 2 months ago
JSON representation

A light-weight library providing Knockout-like two-way declarative data binding for Backbone.

Awesome Lists containing this project

README

        

# Backbone Bind'em

A light-weight javascript library providing [Knockout](https://knockoutjs.com/)-like two-way declarative data binding for [Backbone](https://documentcloud.github.com/backbone/).

[Homepage](https://dundalek.com/bindem/)

Demos: [examples.html](https://dundalek.com/bindem/examples.html)

## Example code

```html


First name:


Last name:


Hello, !




Show info


```

```javascript
var View = Backbone.View.extend({
modelBindings: {
firstName: {
text: 'span.firstName',
value: {
selector: 'input.firstName',
event: 'keyup' }},
lastName: {
text: 'span.lastName',
value: {
selector: 'input.lastName',
event: 'keyup' }},
info: {
html: '#info' },
showInfo: {
checked: '[name=showInfo]',
visible: '#info' }
},
initialize: function() {
Bindem.on.call(this, this.modelBindings, {initialize: true});
}
});

var personModel = new Backbone.Model({
firstName: 'John',
lastName: 'Smith',
info: 'Try to write something in the input fields and see what happens.',
showInfo: false
});

var view = new View({
model: personModel,
el: $('.liveExample')
});
```