如何在 phx.routes 没有未定义函数错误的情况下编写 link 标签
How to write link tag without Undefined function Error with phx.routes
我正在尝试将 link 标记写入 phoenix 模板中的下一页 xxx_path
。
<%= link to: xxx_path(@conn, :main, id) do %>
<% end %>
但是我有以下错误。
** (CompileError) lib/xxx_web/templates/layout/header.html.eex:5: undefined function xxx_path/3
我告诉你phx.routes
C:\Works>mix phx.routes
xxx_path GET / xxxWeb.XxxController :index
xxx_path GET /:id xxxWeb.XxxController :main
怎么了?
谢谢。
我应该写在下面。
<%= link to: Routes.xxx_path(@conn, :main, id) do %>
我正在尝试将 link 标记写入 phoenix 模板中的下一页 xxx_path
。
<%= link to: xxx_path(@conn, :main, id) do %>
<% end %>
但是我有以下错误。
** (CompileError) lib/xxx_web/templates/layout/header.html.eex:5: undefined function xxx_path/3
我告诉你phx.routes
C:\Works>mix phx.routes
xxx_path GET / xxxWeb.XxxController :index
xxx_path GET /:id xxxWeb.XxxController :main
怎么了? 谢谢。
我应该写在下面。
<%= link to: Routes.xxx_path(@conn, :main, id) do %>