'x-bind with forwarded wire:model in a template element
Consider the following, in a blade template:
<template x-for="(product, index) in getProducts()" :key="index">
<li class="flex items-center px-1 py-3 rounded-md hover:bg-gray-50">
<label class="flex items-center justify-between hover:cursor-pointer">
<input type="checkbox" name="products[]" x-bind:value="product.id" class="cursor-pointer form-checkbox" {{ $attributes->wire('model') }} />
</label>
[..]
</li>
</template>
I'm using it as follow:
<x-forms.product-selector wire:model.lazy="activeProducts" />
When playing with checkboxes, nothing happens (i.e no event is fired for livewire).
Would anyone have an idea of what I'm doing wrong ? Thanks
Solution 1:[1]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ubuntu user 130487 |