Skip to main content
1 of 3
Ranga
  • 1.7k
  • 1
  • 14
  • 25

After Summer 18 release (API version 43 and up) we can do this.

Implement lightning:isUrlAddressable interface and use pageReference attribute.

Example. - Component Assume url is https://.lightning.force.com/lightning/cmp/__component name?testAttribute=abc

<aura:component implements="lightning:isUrlAddressable">
   <aura:handler name="init" value="{!this}" action="{!c.doInit}" description="Handler for valueInit event fired when the component has been initialised"/>
        {!v.pageReference.state.testAttribute}
</aura:component>

Component Controller

({
    doInit : function(component, event, helper) {
        console.log(component.get("v.pageReference").state.testAttribute);
    }
})

Console output will look like: "abc"

Ranga
  • 1.7k
  • 1
  • 14
  • 25