view the browser source and check what the code has output to the browser
May 15, 2021
2
Level 1
foreach varibale with alpine breaks livewire pagination
Hi, I have a model to edit post, where the post id is assigned to edit modal from a button like this
@click.prevent="$dispatch('edit-post-modal', { reply_id:'{{$comment->id}}' })"
The above works fine as for editing the post, but this breaks Livewire pagination, which complains as
Uncaught (in promise) DOMException: String contains an invalid character
when clicking on the Livewire next page button, that is this blade variable "{{$comment->id}}". I cannot use $wire.comment->id as this from a @foreach (comments as comment) .
How can I pass a loop variable to alpine js?
Please or to participate in this conversation.