I am exploring the use of the new Lightning:navigation component but it is not working so I'm trying to figure out what is the issue.
First Component - TestURLParameterComponent.cmp (API 43)
<aura:component implements="lightning:isUrlAddressable,force:appHostable,flexipage:availableForAllPageTypes" access="global" >
<lightning:navigation aura:id="navService"/>
<aura:attribute name="url" type="string"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<lightning:button label="Navigate" onclick="{!c.handleClick}"/>
</aura:component>
Controller -
({
doInit: function(component, event, helper) {
},
handleClick : function(component, event, helper) {
var navService = component.find("navService");
var pageReference = {
"type": "standard_component",
"attributes": {
"componentName": "c__URLParameterComponent"
}
}
navService.navigate(pageReference);
}
})
Second Component -
<aura:component implements="lightning:isUrlAddressable,force:appHostable,flexipage:availableForAllPageTypes" access="global" >
<aura:attribute name="pageReference" type="Object"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<div>here</div>
</aura:component>
Controller -
({
doInit : function(component, event, helper) {
console.log(component.get("v.pageReference"));
}
})
The message I receive when I click on the button is "Page doesn't exist. Enter a valid URL and try again".
standard_component
, seems like you are missing additional underscore and that it should be asstandard__component