---
title: "Studio Lifecycle"
framework: angular
version: "2.1.2"
---

# Studio Lifecycle

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

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

## API Ready

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

**Common Uses**

- Saving a reference to the API

## Studio Ready

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

## State Updated

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

## Studio Pre-Destroyed

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](https://www.ag-grid.com/studio/angular/state#saving-and-restoring-state) demonstrates how `studioPreDestroyed` can be used to save and restore Studio state.

### Angular PreDestroy Setup

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:

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