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.
- Host: GitHub
- URL: https://github.com/dundalek/bindem
- Owner: dundalek
- Created: 2012-05-28T16:22:08.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2020-02-07T19:42:24.000Z (over 5 years ago)
- Last Synced: 2025-03-23T20:43:34.376Z (3 months ago)
- Language: JavaScript
- Size: 79.1 KB
- Stars: 13
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.markdown
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')
});
```