You need to sign in to do that
Don't have an account?
Mohita 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);}
})
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);}
})