blset
Phoenix 1.7 rc 1 alias in components not seen
in the new setup with components accessed from a controller
from the docs Components and HEEx Templates — Phoenix v1.7.0-rc.0
Phoenix assumes a strong naming convention from controllers to views to the templates they render. PageController requires a PageHTML to render templates in the lib/hello_web/controllers/page_html/ directory.
With all this setup alias declared in page_html.ex are not seen inside the page_html/* templates.
if completely prefixed inside embedded templates, all is ok, but with aliases placed in the page_html.ex it does not work
in app_web.ex
def controller do
quote do
use Phoenix.Controller, namespace: AppWeb,
formats: [:html, :json, :xlsx, :pdf],
layouts: [html: AppWeb.Layouts]import Plug.Conn endend
the app was converted from 1.6 and views.
While in a newly generated app aliases are seen, it’s not he case in this converted app.
I was wondering what could cause that since the template is reached and the page is shown ok if not using aliases
Most Liked
blset
the reason is that
embed_templates line must appear after alias lines
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









