(Quick Reference)

6.2.1 Syntax - Reference Documentation

Authors: Andres Almiray

Version: 1.2.0

6.2.1 Syntax

These are the three options for writing a binding using the bind node
  • Long

The most complete of all three, you must specify both ends of the binding explicitly. The following snippet sets an unidirectional binding from bean1.prop1 to bean2.prop2

bind(source: bean1, sourceProperty: 'prop1',
     target: bean2, targetProperty: 'prop2')
  • Contextual

This type of binding can assume either the sources or the targets depending on the context. The following snippets set an unidirectional binding from bean1.prop1 to bean2.prop2

    • Implicit source

bean(bean1, prop1: bind(target: bean2, targetProperty: 'prop2'))
    • Implicit target

bean(bean2, prop2: bind(source: bean1, sourceProperty: 'prop1'))

When used in this way, either sourceProperty: or targetProperty: can be omitted; the bind node's value will become the property name, in other words

bean(bean1, prop1: bind('prop2', target: bean2))
  • Short

This type of binding is only useful for setting implicit targets. It expects a closure as the definition of the binding value

bean(bean2, prop2: bind{ bean1.prop1 })