You need to sign in to do that
Don't have an account?
mahamed raheem
Navigate to another LWC component in sites page
Navigate to another LWC component in the sites page
I have tried below but it's not working
import { LightningElement,track,wire} from 'lwc';
import { NavigationMixin } from 'lightning/navigation';
export default class Request_GeneralInfo_lwc extends NavigationMixin(LightningElement) {
}
// button click
ContinueReview(event){
this[NavigationMixin.Navigate]({
type: 'comm__namedPage',
attributes: {
pageName: 'c__request_Review_LWC'
},
state: {
'category': 'param1value'
}
});
}
In this scenario, I have to navigate request_Review_LWC lwc component in the sites page
I have tried below but it's not working
import { LightningElement,track,wire} from 'lwc';
import { NavigationMixin } from 'lightning/navigation';
export default class Request_GeneralInfo_lwc extends NavigationMixin(LightningElement) {
}
// button click
ContinueReview(event){
this[NavigationMixin.Navigate]({
type: 'comm__namedPage',
attributes: {
pageName: 'c__request_Review_LWC'
},
state: {
'category': 'param1value'
}
});
}
In this scenario, I have to navigate request_Review_LWC lwc component in the sites page
You cannot directly navigate to an LWC, you need to create an aura:component and embed your LWC in that component.
Please refer the link for better understanding : https://developer.salesforce.com/forums/ForumsMain?id=9062I000000Xva5QAC
I created aura component and embedded my LWC in that but it's not navigating to another LWC
My LWC components are used in ltng:outApp
below code am using
My Aura APP:
<aura:application extends="ltng:outApp" access="GLOBAL" implements="ltng:allowGuestAccess">
<aura:dependency resource="request_GeneralInfo_lwc"/>
vf Page:
apex:page sidebar="false" showheader="false">
<apex:includeLightning />
<div id="lightningvf" />
<script>
$Lightning.use("c:request_App", function() {
$Lightning.createComponent("c:request_GeneralInfo_lwc",{
},
"lightningvf",
function(cmp) {
console.log("CMP was created");
}
);
});
</script>
</apex:page>
LWC
import { LightningElement,track,wire} from 'lwc';
import { NavigationMixin } from 'lightning/navigation';
export default class Request_GeneralInfo_lwc extends NavigationMixin(LightningElement) {
}
// button click
ContinueReview(){
this[NavigationMixin.Navigate]({ "type": "standard__component",
"attributes": {
"componentName": "c__auraComponent" } });
}
Aura cmp:
<aura:component implements="lightning:isUrlAddressable" access="global" >
<lightning:card title="LWC Navigation">
</lightning:card>
</aura:component>
Hi Raheem,
Might be that ltng:outApp isrestricting your navigation.
You would need to debug it propely, firstly try to check if ContinueReview() method was called and navigated to your Aura cmp as expected, then dive further to check the other LWC.