Phoenix Live Template + Materialize Toast to display flash messages

Hello there, this was a little problematic for a new elixir/phoenix user, but I got it to work, and I wanted to post this so someone might find value in my solution.

materialize appends the dom node to the body element so this script tag needs to be nested here 
        <script phx-update="ignore"> <!-- The phx_update attribute is amazing <3 -->
          let info = '<%= get_flash(@conn, :info) %>';
          let error = '';

            M.toast({ html: info });

1 Like

woops, I replied to the wrong post