Skip to content

Understanding bindings

Kory Nunn edited this page Apr 10, 2014 · 4 revisions

Bindings are the most important parts of a Gaffa application. Understanding how they work is vital to being proficient at creating applications with Gaffa.

What are bindings?

Bindings, in Gaffa, are strings that tell Gaffa how to get and set data in the model.

Bindings resolve to a value, based on an expression.

They can be used to set data to a location in the model.

Where are they used?

Bindings are most often found assigned to Properties on ViewItems, eg:

// A textbox view
var myTextbox = new Textbox();

// Tell the textbox that its 'value' should be bound to 'someProperty' in the model.
myTextbox.value.binding = '[someProperty]';

Bindings are used on Property instances to tell it where to get or set data.

eg:

    textbox.value.binding = '[firstName]';