@microsoft/fast-element > when

when() function

A directive that enables basic conditional rendering in a template.

Signature:
export declare function when<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>): CaptureType<TSource>;

Parameters

ParameterTypeDescription
bindingBinding<TSource, TReturn>The condition to test for rendering.
templateOrTemplateBindingSyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>The template or a binding that gets the template to render when the condition is true.
Returns:

CaptureType<TSource>