This is a prerelease version of FAST (3.0.0-rc.1).

@microsoft/fast-element > HTMLView > bind

HTMLView.bind() method

Binds a view's behaviors to its binding source.

On the first call, this iterates through all compiled factories, calling createBehavior() on each to produce a ViewBehavior instance (e.g., an HTMLBindingDirective), and then immediately binds it. This is where event listeners are registered, expression observers are created, and initial DOM values are set.

On subsequent calls with a new source, existing behaviors are re-bound to the new data source, which re-evaluates all binding expressions and updates the DOM accordingly.

Signature:

bind(source: TSource, context?: ExecutionContext<TParent>): void;

Parameters

Parameter

Type

Description

source

TSource

The binding source for the view's binding behaviors.

context

ExecutionContext<TParent>

(Optional) The execution context to run the behaviors within.

Returns:

void