Gabriel ThaKid
Gabriel ThaKid

Reputation: 887

can someone explain in simple words what data-binding on javascript does?

I'm completely new to this, and I don't seem to be able to understand what it really does, even after researching. I just started learning BackboneJS a few days ago, it has this third party library called Epoxy http://epoxyjs.org/tutorials.html

People kept talking about it and it caught my attention. It has a live example that shows that variables can be displayed as they change. But I still have a few questions remaining.

1- Can other clients see the variables im changing live too? lets say im changing a public image title, will it display live like on my side?

2- As far as I understood this variable could communicate with the same attribute on the database, is this right?

^ if this two arguments don't apply, what's the advantage of using data-binding?

Upvotes: 0

Views: 123

Answers (1)

elclanrs
elclanrs

Reputation: 94101

Data binding is a broad term, it applies to sofware development in general:

Data binding is the process that establishes a connection between the application UI (User Interface) and business logic. If the settings and notifications are correctly set, the data reflects changes when made. It can also mean that when the UI is changed, the underlying data will reflect that change.

Source: http://en.wikipedia.org/wiki/Data_binding

  1. No. Backbone runs on the client. Data binding applies to your view of the page.
  2. I don't understand what you mean by variable. Epoxy does two-way data binding, and provides extensions to manage views and models, but Backbone doesn't interface with your database by default, this is up to you to setup.

The advantage of two-way data binding is that the view is updated automatically when the model changes and viceversa, as opposed to one-way data binding where you have to handle the updates yourself.

I would suggest looking into AngularJS as it provides two-way data binding out of the box and it's very easy to get started. When you feel comfortable with the concept and how it works you can take another objective look at Epoxy.

Upvotes: 2

Related Questions