Data Binding module for ApplicationFrame
npm install @af-modules/databindingAF DataBinding is a up coming Data Binding module for ApplicationFrame.
This library allows fast, high performant and extensible data binding.
With the integrated extension API it is possible to add custom bindings as desired.
``html`
{{itemText}}
`JavaScript
import DataBinding from 'af-DataBinding';
let scope = {
itemText: 'test',
};
scope = DataBinding.makeTemplate('#my-binding-snippet', scope).scope;
`
This short snippet allows to get the template processed and receive an instance
of it. Since it is often not desired to only instantiate a template, a specific
attribute has been created.
`html`
{{itemText}}
The replace attribute tells the binding engine to automatically replace
the template in the DOM with the new instance.
Therefore this would result in the following HTML snippet.
`html`test
`html`
Elementary in this example is the inner template element. It will get
automatically repeated, for every element in the items` array on the scope,
when the surrounding template gets instantiated.