and
Adds a filter, to perform a logical AND (i.e.
&&
) operation with another binding.
and<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 true (according to the ==
operator). The result is the value of the current binding, if its value is equal to false.
Parameters
Return value
A new binding, typed as a union of both original types
Example
// A simple boolean AND
bound.boolean("itemFound").and("hasPrice")
// A conditional string binding
bound.boolean("showCustomer")
.and(bound.strf("Customer: %s", "customer.name"))
Related
- class BindingA class that represents a property binding.