I am getting an issue saving the data with alpine js. I have a form inside a for loop. but, i am unable to set the index for x-model and name of form inputs.
HTML:
<template x-for="(price, index) in prices">
<tr data-id="price.id">
<td class="text-right">
<input type="text" class="form-control" x-bind:name="record.items[${index}].batch" x-model="record.items[${index}].batch">
</td>
</tr>
</template>
Javscript
record: {
items: [],
}
I got this error.
Uncaught ReferenceError: index is not defined.
How to resolve this?