File

forms/src/field_changes.ts

Description

Implements behavior for when a field has changed. By default, the change notification is delegated to BlueriqSession.changed to dispatch an action onto the global message bus.

The primary use-case for this behavioral interface is to specialize the handling of field changes from parent components. For example, changing a field may require a button press to be initiated. In that case, a parent component may customize the behavior for all descendant fields by providing this token as one of its providers.

Example

 * @Component({
 *   providers: [
 *     { provide: FieldChangeBehavior, useExisting: forwardRef(() => ExampleComponent) },
 *   ]
 * })
 * export class ExampleComponent implements FieldChangeBehavior {
 *   @BlueriqChild(Button, '#someButton')
 *   someButton: Button;
 *
 *   constructor(private readonly session: BlueriqSession) {}
 *
 *   changed(field: Field): void {
 *     this.session.pressed(this.someButton);
 *   }
 * }
 *

Index

Methods

Methods

Abstract changed
changed(field: Field)

Called when a field's value is changed through a FormControl that is created using BlueriqFormBuilder.control.

Parameters :
Name Type Optional
field Field No
Returns : void

result-matching ""

    No results matching ""