driftyco/ionic — pull request #1369 by xaka (2014-05-13 05:37:13+00:00)
Title: feat ($ionicActionSheet): pass button object to buttonClicked

Right now `buttonClicked` accepts only the index of the pressed button that means you have to work with indices to decide which one it is. In case you move buttons around to get better UX, you'd have to be very careful with those indices. It would be easier to add `id` property to buttons and simply check for it. Index-agnostic solution is more maintainable and leads to less changes to the code when the buttons order is being changed. You could even have something like that:

```
var profileButton = {text: profile};
...
buttonClicked: function (index, button) {
if (button === profileButton) {
...
}
}
```

I wish we could pass button as a first argument, but that would break a compatibility with previous versions.