elixir - How to render raw HTML code in Phoenix Framework? -
i'm storing raw html contenteditable tag in rethinkdb database. want display content after retrieving it.
html.eex
<div id="contenteditabletext"> <%= %{"contenttext" => contenttext} <- @contenttext.data %> <div><%= "#{contenttext}" %></div> <% end %> </div>
i can sucessfully retrieve it, it's displaying raw html itself.
the phoenix_html
library provides raw/1 function case. phoenix_html
included default should need do:
<div id="contenteditabletext"> <%= %{"contenttext" => contenttext} <- @contenttext.data %> <div><%= raw(contenttext) %></div> <% end %> </div>
Comments
Post a Comment