I want to use a module attribute in HEEx code, like following code:
defmodule MyView do
use Phoenix.LiveView
@test "Test!"
def render(assigns) do
~H"""
<div>{@test}</div>
"""
end
end
I want @test
will be interpreted as "Test!"
, the module attribute, but the compiler tries to read assigns.test
and occurs error. Is there any convenient way to use module attributes in the HEEx?