yarn alpinejs 2.0.2
v2.0.2

latest releases: 3.9.3, 3.9.2, 3.9.1...
4 years ago

Fixed

  • For (item, index, group) in items, index and group weren't being made available to elements inside an x-for <template> tag. Now they are #208
<div x-data="{ items: ['foo'] }">
    <template x-for="(item, index) in items">
        <div>
            <h1 x-text="items.indexOf(item)"></h1>
            // Same as...
            <h2 x-text="index"></h2>
        </div>
    </template>
</div>
  • Using x-for and x-if in conjunction (<template x-for="..." x-if="...">) resulted in odd behavior. It is now fully possible and supported #208
<div x-data="{ items: ['foo', 'bar'], show: false }">
    <button @click="show = ! show"></button>

    <template x-if="show" x-for="item in items">
        <span x-text="item"></span>
    </template>
</div>

Don't miss a new alpinejs release

NewReleases is sending notifications on new releases.