Constructor
new BindingUtil()
BindingUtils provides One-way and Two-way binding with Just single statement.
BindingUtils is Singleton class.
- Source:
Examples
Add Binding :
BindingUtils.addBinding(srcele, "value", "change", destele, "value", false);
Remove Binding :
BindingUtils.removeBinding(srcele, "value");
Chain Binding :
DOM Element to JavaScript Object :
BindingUtils.addBinding(srcele, "value", "change", this.myCustomModel, "setValue", false);
JavaScript Object to DOM Element :
BindingUtils.addBinding(this.myCustomModel, "getValue", "change", destele, "value", false);
Two-way Binding :
BindingUtils.addBinding(srcele, "value", "change", destele, "value", true);
Methods
Name | Description |
---|---|
addBinding | - Add Binding method binds Source Object property with Target Object Property with Synchronize on SourceObject Event |
removeBinding | - Add Binding method binds Source Object property with Target Object Property with Synchronize on SourceObject Event |
addBinding(_srcObj, _srcProp, _evtname, _targObj, _targProp, twoway)
- Add Binding method binds Source Object property with Target Object Property with Synchronize on SourceObject Event
Parameters:
Name | Type | Description |
---|---|---|
_srcObj |
object | Source DOM Element or Object |
_srcProp |
string | Source Property |
_evtname |
string | Source Object EventName on which Binding Trigger |
_targObj |
object | Target DOM Element or Object |
_targProp |
string | Target Property |
twoway |
Boolean | True when Binding is Two-way |
- Source:
Example
Add Binding :
BindingUtils.addBinding(srcele, "value", "change", destele, "value", false);
removeBinding(_srcObj, _evtname)
- Add Binding method binds Source Object property with Target Object Property with Synchronize on SourceObject Event
Parameters:
Name | Type | Description |
---|---|---|
_srcObj |
object | Source DOM Element or Object |
_evtname |
string | Source Object EventName on which Binding Trigger |
- Source:
Example
Remove Binding :
BindingUtils.removeBinding(srcele, "value");