I’d like to use the ~E
sigil inside of a macro. For some reason the assigns
variable is not accessible:
defmacro __using__(_opts) do
quote do
use AppWeb, :view
def render("index.html", assigns) do
~E"""
<%= @test %>
"""
end
end
end
Result:
expected “assigns” to expand to an existing variable or be part of a match
Writing the render/2
function directly into a view works fine. Is there a way to make this work?
Thanks!