Hi all,
when using the Phoenix.HTML.Link.link/2 function in a leex template only an empty struct gets passed to the handle_event function.
<%= link to: "#", "phx-click": "delete_session", "phx-value": session.id, title: "Delete" do %> <i class="fa fa-trash"></i> <% end %>
Generated HTML seems also fine:
<a href="#" phx-click="delete_session" phx-value="3" title="Delete"> <i class="fa fa-trash"></i> </a>
I also tried it with phx_click and phx_value. Oddly, my event gets triggered, but fails due to the missing parameter.
def handle_event("delete_session", id, socket) do
session = MyApp.get_session!(id)
{:ok, _session} = MyApp.delete_session(session)
{:noreply, fetch(socket)}
end
In the console it shows that only %{} gets transmitted to the function.
I use a button at different parts of the project and there the values get transmitted, but this also does not work here … Feeling stuck