April 2016
Beginner to intermediate
300 pages
6h 58m
English
That link function packs a surprising amount of punch into a small package. Phoenix helpers provide a convenient way to drop common HTML structures onto your view. There’s nothing special about them. Helpers are simply Elixir functions. For example, you can call the functions directly in IEx:
| | $ iex -S mix |
| | iex> Phoenix.HTML.Link.link("Home", to: "/") |
| | {:safe, ["<a href=\"/\">", "Home", "</a>"]} |
| | |
| | iex> Phoenix.HTML.Link.link("Delete", to: "/", method: "delete") |
| | {:safe, |
| | [["<form action=\"/\" class=\"link\" method=\"post\">", |
| | "<input name=\"_method\" type=\"hidden\" value=\"delete\"> |
| | <input name=\"_csrf_token\" type=\"hidden\" value=\"UhdjBFUcOh...\">"], |
| | ["<a data-submit=\"parent\" ... |
Read now
Unlock full access