Newer Version Available
aura:valueDestroy
Indicates that a value is being destroyed.
This event is automatically fired when an attribute value is being destroyed. The
aura:valueDestroy event is handled by a
client-side controller. A component can have only one <aura:handler name="destroy"> tag to handle this event.
The aura:valueDestroy event contains these attributes.
1<aura:handler name="destroy" value="{!this}" action="{!c.handleDestroy}"/>This client-side controller handles the aura:valueDestroy event.
1({
2 valueDestroy : function (component, event, helper) {
3 var val = event.getParam("value");
4 // Do something else here
5 }
6})For example, let’s say that you are viewing your Lightning component in the Salesforce1 app. This aura:valueDestroy event is triggered when you tap on a different menu item on the Salesforce1 navigation menu, and your component is destroyed. In this example, the token attribute returns the component that’s being destroyed.
The destroy handler contains these required attributes.| Attribute Name | Type | Description |
|---|---|---|
| name | String | The name of the handler, which must be set to destroy. |
| value | Object | The value for which you want to detect the event for. |
| action | Object | The client-side controller action that handles the value change. |
| Attribute Name | Type | Description |
|---|---|---|
| value | String | The value being destroyed, which is retrieved via event.getParam("value"). |