Access to repeater item from inside

In a repeater I do have a button inside each item (which should open a modal containing a list of models) and I want the button to get the current index of each row. How can I access the item from the button (which is a Livewire component)? I want to pass the current index (of each button) to the modal like this:
<button type="button" wire:click="$emit('openModal', 'app.livewire.list-recent-persons', {{ json_encode(['currentIndex' => $currentIndex]) }})">
Open modal
</button>
<button type="button" wire:click="$emit('openModal', 'app.livewire.list-recent-persons', {{ json_encode(['currentIndex' => $currentIndex]) }})">
Open modal
</button>
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?