Skip to main content

foundation-utils.whenelse

Home > @genesislcap/foundation-utils > whenElse

whenElse() function

Directive that allows supplying an "else" template to the traditional https://www.fast.design/docs/api/fast-element.when/#when-function directive

Signature:

export declare function whenElse<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, trueTemplateOrTemplateBinding: WhenTemplate<TSource>, falseTemplateOrTemplateBinding: WhenTemplate<TSource>): CaptureType<TSource>;

Parameters

Parameter

Type

Description

binding

Binding<TSource, TReturn>

The condition to test for rendering.

trueTemplateOrTemplateBinding

WhenTemplate<TSource>

The template or a binding that gets the template to render when the condition is true.

falseTemplateOrTemplateBinding

WhenTemplate<TSource>

The template or a binding that gets the template to render when the condition is false.

Returns:

CaptureType<TSource>