How to insert html into link text using Phoenix Framework?

I have a snippet that looks like this:

<%= link "<i class='fa fa-sign-out' aria-hidden='true'></i>", to: auth_path(@conn, :delete), method: :delete, class: "btn btn-danger" %> 

This is the link . I would like to place the i element inside the text so that it displays an icon instead of text. However, this eludes all html characters and displays as text.

How can I display me as html?

+6
source share
1 answer

Put the internal html in the do block:

 <%= link to: auth_path(@conn, :delete), method: :delete, class: "btn btn-danger" do %> <i class='fa fa-sign-out' aria-hidden='true'></i> <% end %> 

This is documented here .

+9
source

All Articles