Skip to main content
Amit Vaidya ha fatto una domanda in #Lightning Experience
Hi Everyone,

 

//Component: LightningNavigate

<aura:component implements="force:appHostable">

<div id="aura-page">

<div class="container">

<ui:button label="gotoURL" press="{!c.gotoURL}" />

</div>

<div class="container">

<ui:button label="navigate" press="{!c.navigate}" />

</div>

</div>

</aura:component>

//Controller

({

gotoURL : function(component, event, helper) {

helper.gotoURL(component);

},

navigate : function(component, event, helper) {

helper.navigate(component);

}

})

//Helper

({

gotoURL : function (component, event) {

var urlEvent = $A.get("e.force:navigateToURL");

urlEvent.setParams({

"url": "/006/o"

});

urlEvent.fire();

},

navigate : function(component,event) {

var address = '/Salesforce.com+Inc/@37.793779,-122.39448,17z/';

var urlEvent = $A.get("e.force:navigateToURL");

urlEvent.setParams({

"url": 'https://www.google.com/maps/place/' + address

});

urlEvent.fire();

}

})

//App

<aura:application >

<c:LightningNavigate />

</aura:application>

While running above code, I am getting following issue:

Something has gone wrong. Action failed: c$LightningNavigate$controller$gotoURL [TypeError: Cannot read property 'setParams' of undefined] Failing descriptor: {c$LightningNavigate$controller$gotoURL}. Please try again.

Can someone please help me to resolve it?

Thanks,

Amit
8 risposte
0/9000