or
Adds a filter, to perform a logical OR (i.e.
||
) operation with another binding.
or<U = any>(source: Binding<U> | string): Binding<T | U>
Summary
This method can be used to combine two bindings logically, using the ||
operator. The resulting bound value is the value of the other binding, if the current bound value is equal to false (according to the ==
operator). The result is the value of the current binding, if its value is equal to true.
Parameters
Return value
A new binding, typed as a union of both original types
Example
// A simple boolean OR
bound.boolean("itemFound").or("hasDefault")
// A conditional string binding
bound.string("customer.name")
.or(bound.strf("Default: %s", "defaultCustomer.name"))
Related
- class BindingA class that represents a property binding.