How to use Lightning:navigation to navigate another component

Use: We use lightning:navigation component to navigate custom component.

Functionality

:

new Lightning Navigation

Short description: Using lightning:isUrlAddressable ( add new interface in Summer 18 release ) interface , we can handle which Lightning component can be opened.Usually lightning:navigation component generate a URL and navigate that URL using navigate() function.

Example :

Write a Response

Your email address will not be published.


2 comments on “How to use Lightning:navigation to navigate another component”

  • Anil says:

    Hello thanks for your article ,the same logic is not working for custom object do i need to do any adaptation?

    • Nigam says:

      Try this code for recordPage navigation

      var navLink = component.find("navLink");
      var pageRef = {
      type: 'standard__recordPage',
      attributes: {
      actionName: 'view',
      objectApiName: 'Job__c',
      recordId : '0hj7FXXX51uq5QAA' // change record id.
      },
      };
      navLink.navigate(pageRef, true);

Find Out How We Can Help

If you're ready to find out more about how SimplusLabs can help energize your workers, your customers, and your business with a different experience, let's talk.