elixir - How to Render Raw JavaScript Data in Phoenix Framework -


i got list in controller:

data = ["one", "two"] 

i love render in eex template as:

<script> var data = ["one", "two"] </script> 

how can make it, tried var data = <%= raw(@data) %>, got var data = [one, two].

got answer post,

this how make in last:

<%= raw(poison.encode!(@data)) %> 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -