I would like to know how to dynamically update phoenix variables using javascript functions in my Phoenix templates.
Currently I have a list sent from my controller and I am using an elixir for loop to render html based on what is inside of it. I would like to be able to type into an input box and based on what is in the input box filter the list.
Example of the code
<%= for word <- @words do %>
<p><%= word %></p>
<% end %>
I would like to be able to dynamically filter @words based on a js function.
Does anyone know how this can be achieved?
Thanks in advance
rawlikevar bob = <%= raw Poison.encode!() %>. stackoverflow.com/questions/39052160/… - The Brofessor@wordsfrom your js either by setting the value into a global variable from your view template or by setting it to adata-wordsattribute on some of your HTML elements - hisa_py