Lifecycle hooks

There are several lifecycle hooks available for you to subscribe to and perform various actions in response to events.

These lifecycle hooks can be defined on the JSF definition as such:

$lifeCycle?: {
  $beforeFormInit?: {
    $eval: string;
  };
  $afterFormInit?: {
    $eval: string;
  };
  $beforeFormDestroy?: {
    $eval: string;
  }
  $afterFormDestroy?: {
    $eval: string;
  },
  $onFormValueChange?: {
    $eval: string;
  },
  $onFormStatusChange?: {
    $eval: string;
  }
};

List of available lifecycle hooks:

Lifecycle hook

JSF lifecycle property

Description

Before form init

$beforeFormInit

Called before the JSF builder instance is created which allows you to modify the document or builder options. Provides two eval context variables:

  • $doc JSF document

  • $optionsBuilder options

After form init

$afterFormInit

Called after the JSF builder instance was created. Note that the Angular layout

omponents have not yet been created at this stage.

Before form destroy

$beforeFormDestroy

Called before the JSF builder instance is about to be destroyed, due to the Angular jsf doc component being destroyed or otherwise.

After form destroy

$afterFormDestroy

Called after the JSF builder instance has been destroyed.

Form value change

$onFormValueChange

Called every time a form property's value changes. Provides two additional eval context variables:

  • $path Path of changed prop

  • $data An object containing the information about the change

Form status change

$onFormStatusChange

Called every time a form's property state changes (valid, invalid, disabled, ...). Provides two additional eval context variables:

  • $from An object containing information about the changed prop path

  • $data An object containing information about the status change

Last updated

Was this helpful?