kalkatfyodor
Alpine.js x-transition not working in LiveView for <template> tag
I have this code inside liveview in Phoenix 1.6:
<div x-data="{ open: false }" x-on:click.outside="open = false" x-on:keydown.escape="open = false">
<button x-on:click="open = !open">
Click me
</button>
<div x-show="open" x-transition.opacity>
<div>
<ul>
<li>Dogs</li>
<li>Cats</li>
<li>Snakes</li>
</ul>
</div>
</div>
</div>
And the transition fade in/out animation works.
But when I do this:
<div x-data="{ open: false }" x-on:click.outside="open = false" x-on:keydown.escape="open = false">
<button x-on:click="open = !open">
Click me
</button>
<template x-show="open" x-transition.opacity>
<div>
<ul>
<li>Dogs</li>
<li>Cats</li>
<li>Snakes</li>
</ul>
</div>
</template>
</div>
It doesn’t. In fact nothing shows up at all and I have to change x-show to x-if to at least be able to make the show hide work albeit without any fade in/out effect at all:
<div x-data="{ open: false }" x-on:click.outside="open = false" x-on:keydown.escape="open = false">
<button x-on:click="open = !open">
Click me
</button>
<template x-if="open" x-transition.opacity>
<div>
<ul>
<li>Dogs</li>
<li>Cats</li>
<li>Snakes</li>
</ul>
</div>
</template>
</div>
How can I make this transition to work on the <template> element?
Most Liked
cmo
1
Popular in Questions
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service.
Currently when I de...
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
Credo is smart enough to check for (something like) this:
assert length(the_list) == 0
with this response:
Checking if an enum is empt...
New
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this
"1000"
What is the ...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
Other popular topics
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
Hi folks,
Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
New
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine)
This is a plugin that adds support for Elixir to JetBrains IntelliJ...
New
Got a question about when to concat vs. prepending items to list then reversing to achieve appending.
So i know lists boil down to [1 | ...
New
Hi there,
I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)?
Would
mix ecto.rollback -v 200809061...
New
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance










