These are the three options for writing a binding using the bind
node
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')
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
bean(bean1, prop1: bind(target: bean2, targetProperty: 'prop2'))
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 wordsbean(bean1, prop1: bind('prop2', target: bean2))
This type of binding is only useful for setting implicit targets. It expects a closure as the definition of the binding valuebean(bean2, prop2: bind{ bean1.prop1 })