I’m trying to create a single file sample app using the following as an example. But, for some reason, the layout page will not render / load. However, the inner content does.
Thank you for any assistance.
I’m trying to create a single file sample app using the following as an example. But, for some reason, the layout page will not render / load. However, the inner content does.
Thank you for any assistance.
The problem is solved. I used this guide to help in the troubleshooting.
https://github.com/DockYard-Academy/beta_curriculum/blob/main/reading/phoenix_1.7.livemd
It was missing this line:
plug(:put_root_layout, {PhoenixDemo.Layouts, :live})
In the sample, this:
defmodule PhoenixDemo.Router do
use Phoenix.Router
import Phoenix.LiveView.Router
pipeline :browser do
plug(:accepts, ["html"])
end
scope "/", PhoenixDemo do
pipe_through(:browser)
live("/", SampleLive, :index)
end
end
Should be:
defmodule PhoenixDemo.Router do
use Phoenix.Router
import Phoenix.LiveView.Router
pipeline :browser do
plug(:accepts, ["html"])
plug(:put_root_layout, {PhoenixDemo.Layouts, :live})
end
scope "/", PhoenixDemo do
pipe_through(:browser)
live("/", SampleLive, :index)
end
end