Computed data properties (declared on instance)
HTML:
<!-- data-linking-->
<input data-link="fullName()" />
...
<td data-link="fullName(true)" ></td>
<!-- data-bound tag-->
{^{:fullName(true)}}
Script:
//====================== Data ======================
var person = {
firstName: "Jeff",
lastName: "Friedman",
// Computed fullName
fullName: fullName
};
// Parameterized computed observable
function fullName(reversed) { ... }
// Declare dependencies
fullName.depends = ["firstName", "lastName"];
// For two-way binding of computed observables, provide a setter
fullName.set = function(val) {
$.observable(this).setProperty({
lastName: ...,
firstName: ...
});