'slds button event source getting error aura component

I need help in getting the button attribute value in the controller.js file from .cmp file as below:

//MyButton.cmp file

<aura:iteration items="{options}" var="option">
  <button onclick="{!c.getValue}" value="{!option}"></button
</aura:iteration>

//MyButtonController.js

getValue:function(cmp,event,helper){
var optionValue = event.getSource().get("v.value");//breaking coode here..

}

Can anyone please help me to get value?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source