I am exploring lightning experience and trying to leverage aura framework.
I have a button that calls an event e.force:navigateToURL
.
Initially it gave an error :
Action failed: c:LightningForceNavigateToURLDemo$controller$gotoURL [Cannot read property 'setParams' of undefined]
So I added aura dependency markup in the lightning component below. So the error is gone, but still the redirect doesnot happen. Am I missing anything? Any help is appreciated.. Thanks in advance.
Below is my code for quick reference:
Lightning Component:
<aura:component implements="force:appHostable">
<aura:dependency resource="markup://force:navigateToURL" type="EVENT"/>
<div id="aura-page">
<div class="container">
<ui:button label="gotoURL" press="{!c.gotoURL}" />
</div>
</div>
</aura:component>
Client side controller:
({
gotoURL : function(component, event, helper) {
helper.gotoURL(component);
}
})
Helper:
({
gotoURL : function (component) {
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": "/006/o"
});
urlEvent.fire();
}
})