Newer Version Available

This content describes an older version of this product. View Latest

aura:locationChange

This event is automatically fired when the hash part of the URL has changed.
Use an <aura:handler> tag to react to a hash value change. A component can have only one <aura:handler event="aura:locationChange"> tag to handle this event.
1<aura:handler event="aura:locationChange" action="{!c.update}"/>
This client-side controller handles the aura:locationChange event. In this example, the handler is wired to the update action.
1({
2    update : function (component, event, helper) {
3        // Get the new hash from the event
4        var loc = event.getParam("token");
5        // Do something else
6    }
7})
The aura:locationChange handler contains these required attributes.
Attribute Name Type Description
event String The name of the event, which must be set to aura:locationChange.
action Object The client-side controller action that handles the event.
The aura:locationChange event contains these attributes.
Attribute Name Type Description
token String The hash part of the URL.
querystring Object The query string portion of the hash.