I just found out code like this in phoenix html source code.
def button(opts, do: contents) do
button(contents, opts)
end
What is that do: contents
?? If i want to use this api, as per the doc, I can do button("hello", to: "/world")
. So I am sure that do: contents
is not keyword list.
It is definitely a keyword list. This handles the following syntax:
<%= button(to: path) do %>
<more html here>
<% end %>
3 Likes
There’s a second function clause handling button("hello", to: "/world")
.
3 Likes
hmm, i didnt find that in the doc.
Thanks, that clears it up
i have question that is not related with this question.
Is there a way to disable the button?
button "Button", disabled: true
2 Likes