Formatters
Formatters are functions that mutate the incoming and/or outgoing value of a binding. You can use them to format dates, numbers, currencies, etc. and because they work in a similar fashion to the Unix pipeline, the output of each feeds directly as input to the next one, so you can stack as many of them together as you like.
Formatters are applied by piping them to binding declarations using |
as a delimiter.
Computed
Computed values can be stored on an object as functions. Use the watch
formatter to track changes on one or more dependent properties that must be passed as arguments.
Consider the person object in the example below.
In the binding below, the fullName
function will be called each time the firstName
or lastName
properties change.
Event Args
It's not possible to pass parameters to a standard TinyBind event binding. Use the args
formatter to pass parameters to an event.
In the following example, the word red
is passed to the myClick
click
event.
Property
Use the property
formatter to dynamically reference a property on a object.
In the example below, the value in the name
property on the item
objects in the items
array will be put into the label
.
The name
parameter to the property
formatter can be passed to the component as an attribute to make the reference dynamic.
For more on formatters, visit the Tinybind formatters page.
Last updated