0 minutes, 12 seconds

Alpine Test XFOR

Example of X-FOR TEMPLATE using X-BIND of HTML attributes

<div x-data="notes = [{text: 'A', position: '10'}, {text: 'B', position: '20'}, {text: 'C', position: '30'}]">
<template x-for="note in notes">
    <span x-text="note.text" x-bind:style="'margin-left: ' + note.position + 'px;'"></span>
</template>
</div>

Result

Previous Next