Docs (4.0.0)
class Binding method

else

Adds a filter, to use the provided value instead of a bound value that’s equal to false.

else<U>(falseValue: U): Binding<T | U>

Summary

This method can be used to substitute the bound value with a fixed value, if the bound value is equal to false (according to the == operator), e.g. for bound undefined, null, false, zero, and empty string values.

Note
Alternatively, use the defaultValue argument to the bound() function to specify a default value that’s used if the bound value is undefined.

Parameters

  • falseValue — The value to be used if the bound value is equal to false

Return value

A new binding, typed like the given value

Example

// A label that displays a value OR (localized) "None"
ui.label(
  bound("customer.name").else(strf("None"))
)

Related