function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sarita Pa 3Sarita Pa 3 

Invoke LWC from Another LWC

Hi Team,

I have an LWC as a tost and on that lwc i have a populate button, on click of the Populate button i need to launch a Modal (which is another LWC).
i used below code to do that how ever it is opening in a different tab. I need to open in the same tab.
Below is the code:

Populate(){

var compDetails ={
    compDef: "c:populateLwc", (THis is the name of the another LWC which i want to open)
    attributes:{
        propertyvalue:"500"
    }
};
var encodedCompDetails = btoa(JSON.stringify(compDetails);
    this[NavigationMixin.Navigate](
    {
        type: 'standard_webPage',
        attributes :{
            url:'/one/one.app#'+ encodedCompDetails;
        }
    }
    )
Appreciate your help in advance
 
ANUTEJANUTEJ (Salesforce Developers) 
Hi Sarita,

>> https://salesforcediaries.com/2020/06/07/navigate-to-lightning-web-component-from-another-lightning-web-component/

The above link has an implementation of calling an lwc from another.

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.
Sarita Pa 3Sarita Pa 3
hi, Thank you for your quick response, this is launching a new tab. I want this to be launched in same tab. Thanks and regards,