I have two links (not buttons) that I'm trying to insert in a Lightning component, but having problems firing them. I start with basic HTML <a>
elements and give each an onclick
attribute:
<div class="slds-float_left">
<a aura:id="premStButtonId"
onclick="{! c.handleButtonClick }">Statement</a>
</div>
<div class="slds-float_right">
<a aura:id="paySumButtonId"
onclick="{! c.handleButtonClick }">Summary</a>
</div>
In my Controller I'm using a switch statement so I won't have to repeat the bulk of code. But I specify the window.location.href
for the link to go to:
({
handleButtonClick : function(component, event, helper) {
var buttonSource = event.getSource();
var buttonId = buttonSource.getLocalId();
switch(buttonId) {
case 'premStButtonId':
window.location.href = '/premSt/default/';
break;
case 'paySumButtonId':
window.location.href = '/paySum/default/';
break;
}
}
})
I'm still very much a newbie with this, so I can't see where this would fail to fire the link.