How to Navigate to LWC Aura Component | How to use Navigation Service (NavigationMixin.Navigate) Navigate to LWC Aura Component in LWC

161 views

Hey guys, today in this post we are going to learn about How to use Navigation Service (NavigationMixin.Navigate) Navigate to LWC Aura Component in LWC.

Here are the steps to use the navigation service.

  • Navigation service uses a PageReference.And a page reference is JavaScript that describes its page type, its attributes, and the state of the page.
  • First, we need to import the lightning/navigation module.
  • Use this Syntax:- Import {NavigationMixin} from β€˜lightning/navigation;

 

Apply the NavigationMixin function to your component’s base Class.

Challenges in your career

🎯 If You Are Facing Any Of These 6 Challenges in your career.

  • Learn Salesforce Development
  • Career Confusion
  • No Interview Call
  • Low Salary
  • No Promotion/Growth
  • No Finding New Job Opportunity
  • Why you stucking from past so many years in same company?

 

 

Final Output β†’

 

Other related post that would you like to learn in Salesforce

 

 

Create HTML Page β†’

Step 1:- Create HTML Page : navigationPageLwc.html

navigationPageLwc.html [HTML PAGE]


  1.     <template>
  2.  
  3.  
  4. <!-- Navigate to LWC Aura Component-->
  5.  
  6.  
  7. <lightning-card title="Navigate to Aura Component">
  8.  
  9.     <div class="slds-m-around_medium">
  10.         <TABLE class="slds-table slds-table_bordered slds-table_col-bordered">
  11.             <tr>
  12.                 <td STYLE="width:50%;">Navigation TO Aura Component</td>
  13.                 <td STYLE="width:50%;">
  14.                     <lightning-button variant="brand" label="Navigation to Aura Component" onclick={actionToNavigateAuraCmp}></lightning-button> 
  15.  
  16.  
  17.                 </td>
  18.             </tr>   
  19.  
  20.  
  21.         </table>
  22.     </div>
  23.  
  24. </lightning-card>
  25. </template>

 

Create navigationPageLwc.js β†’

Step 2:- Create JavaScript Page : function.js

navigationPageLwc.js [JavaScript Page]


  1.    import { LightningElement, api } FROM 'lwc';
  2. import {NavigationMixin} FROM 'lightning/navigation';
  3.  
  4. export DEFAULT class NavigationPageLwc extends NavigationMixin(LightningElement) {
  5.  
  6. // Navigate TO Aura Component
  7.  
  8.  
  9. actionToNavigateAuraCmp(){
  10.  
  11.    this[NavigationMixin.Navigate]({
  12.       TYPE:'standard__component',
  13.       attributes:{        
  14.         componentName:'c__formValidationCmp'
  15.  
  16.       }
  17.  
  18.    });
  19.  
  20. }
  21.  
  22. }

 

 

Create Lightning Web Component Meta XML

Step 3:- Create Lightning Web Component : navigationPageLwc-meta.xml

SFDX:Lightning Web Component >> New >> navigationPageLwc-meta.xml

navigationPageLwc-meta.xml [LWC Meta Data XML]

  1.      <?xml version="1.0" encoding="UTF-8"?>
  2. <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
  3.     <apiVersion>59.0</apiVersion>
  4.     <isExposed>true</isExposed>
  5.     <targets>
  6.         <target>lightning__AppPage</target>
  7.         <target>lightning__RecordPage</target>
  8.         <target>lightning__HomePage</target>
  9.     </targets>
  10.  
  11. </LightningComponentBundle>

 

 

Further post that would you like to learn in Salesforce

 

 

FAQ (Frequently Asked Questions)

Can we navigate from one LWC to another LWC?

The user can navigate from one LWC to another by embedding the LWC in an Aura Component and then walking from the Aura Component to the LWC.

How to debug the lwc component?

The simplest way to run and debug a component during development is to create a Lightning Page and add your component to it. Then load the Lightning Page in your preferred browser and use your favorite inspection and debugging tools. LWC debugging is optimized for Chrome DevTools.

What is LMS in LWC Salesforce?

Lightning Message Service (LMS) is a communication framework provided by Salesforce that enables effective communication between Lightning Web Components (LWC) and other components on a Lightning page.

 
  

Our Free Courses β†’

πŸ‘‰ Get Free Course β†’

πŸ“Œ Salesforce Administrators

πŸ“Œ Salesforce Lightning Flow Builder

πŸ“Œ Salesforce Record Trigger Flow Builder

πŸ‘‰ Get Free Course β†’

πŸ“Œ Aura Lightning Framework

πŸ“Œ Lightning Web Component (LWC)

πŸ“Œ Rest APIs Integration



Hi, This is Vijay Kumar behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio] | | The Sitemap where you can find all published post on w3web.net