The Controller for LiveView rendering.
Renders a live view from a Plug request and sends an HTML response.
Renders a live view from a Plug request and sends an HTML response.
Before rendering, the @live_module assign will be added to the connection assigns for reference.
See Phoenix.LiveView.Helpers.live_render/3 for all supported options.
defmodule ThermostatController do
...
import Phoenix.LiveView.Controller
def show(conn, %{"id" => thermostat_id}) do
live_render(conn, ThermostatLive, session: %{
"thermostat_id" => id,
"current_user_id" => get_session(conn, :user_id)
})
end
end
© 2018 Chris McCord
Licensed under the MIT License.
https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.Controller.html