Docs (4.0.0)
class Binding method

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

  • source — Another instance of Binding, or a source path that will be passed to bound()

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