0

I have a Lightning component for custom login page after passing login details navigate to some details page. There I have a button called "goBackToLoginPage".How to implement this logic please help me, anyone.

Thanks, Raghu

1 Answer 1

0

You can use lightning:navigation component to navigate to a given pageReference or to generate a URL from a pageReference.

PageReference is a reference to a page, providing a well-defined structure that describes the page type and its corresponding values. You should use the PageReference definitions instead of attempting to parse the URL directly. The following PageReference properties are supported.

PROPERTY    TYPE    DESCRIPTION
type        string  Required. The API name of the PageDefinition.
attributes  object  Required. Values for each attribute specified by the PageDefinition.
state       object  Additional parameters, such as filterName, which is tied to the query string of the URL in Lightning Experience. The routing framework doesn't depend on state to render a page. Note: Lightning communities don't support the state property.

You can also navigate directly to a page using a onclick handler.

    <lightning:navigation aura:id="navService"/>
<a href="{!v.url}" onclick="{!c.handleClick}">Link</a>
<lightning:button label="Navigate" onclick="{!c.handleClick}"/>

In your client-side controller, use the navigate() method to navigate to the page.

    ({
    handleClick: function(cmp, event, helper) {
        var navService = cmp.find("navService");
        // Uses the pageReference definition in the init handler
        var pageReference = cmp.get("v.pageReference");
        event.preventDefault();
        navService.navigate(pageReference);
    }
})

Read more here:- Navigation

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .