This is a simple component, not sure what I am missing, this is exactly referred in the docs: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_force_navigateToURL.htm
Component:
<aura:component >
<aura:handler name="init" action="{!c.navigate}" value="this"/>
</aura:component>
JSController:
({
navigate : function(component, event, helper) {
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": 'https://www.google.com/maps/place/'
});
urlEvent.fire();
}
})
Error:
This page has an error. You might just need to refresh it. Action failed: c:navigatetoURlcmp$controller$navigate [Cannot read property 'setParams' of undefined] Failing descriptor: {c:navigatetoURlcmp$controller$navigate}
address