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
Mohita KalraMohita Kalra 

Hi All, Can anyone help me with below code,? I basically want PQRTEST component to open in new tab but I want to remain on the same page and not move to other tab.

Code :
Component 1:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" >
  <aura:attribute name="pageReference" type="Object"/>  
    <aura:attribute name="url" type="String"/>
    <lightning:navigation aura:id="navService"/>
    <div>
     I am your first component !!
    </div>
  <aura:handler name="init" value="{!this}" action="{!c.mycomp}"/>
</aura:component>

Controller 1 :
({
    mycomp: function(cmp, event, helper) {
      var navService = cmp.find("navService");
      var pageReference = {
                         "type": "standard__component",
                         "attributes": {
                                         "componentName": "c__PQRTEST"
                                       }, 
                         "state": {
                             'message':'This is the target page'
                                  }
                          };
       cmp.set("v.pageReference", pageReference);
       const handleUrl = (url) => {
           window.open(url); };
           navService.generateUrl(cmp.get("v.pageReference")).then(handleUrl);}
})