11.10. Binding Converters

When you bind data, you might want to perform some processing on a value before rendering it. For example, maybe you don't need the level of precision the data has, or perhaps you want to convert it to a different measurement or format it to the user's current locale. This can be accomplished with a converter that is simply a standard JavaScript function.

This example creates a function to uppercase a string:

function ToUpper(Input) {
  return Input.toUpperCase();
}

This function can then be used in binding like so:

<div class=""> {binding Name, convert=ToUpper} </div>

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.39.144