Angular Embedded AnalyticsStudio Lifecycle

This section covers some common lifecycle events that are raised after Studio initialisation, data is ready, and before Studio is destroyed.

The events on this page are listed in the order they are raised.

API Ready Copy Link

The apiReady event fires upon Studio initialisation but before the data may be ready or rending complete.

Common Uses

  • Saving a reference to the API

Studio Ready Copy Link

The studioReady event fires when the Data Engine has been initialised and so data is ready. Rendering may not have completed.

State Updated Copy Link

The stateUpdated event fires every time Studio's state changes.

Studio Pre-Destroyed Copy Link

The studioPreDestroyed event fires just before Studio is destroyed and is removed from the DOM.

Common Uses

  • Clean up resources.
  • Save Studio state.
  • Disconnect other libraries.

The Studio State Example demonstrates how studioPreDestroyed can be used to save and restore Studio state.

Angular PreDestroy Setup Copy Link

When using Angular, the studioPreDestroyed event handler must be registered via Studio properties instead of as an Output event handler to work correctly.

For example:

this.studioProperties = {
    onStudioPreDestroyed: () => {
        // handler code
    }
};