phoenix_live_view v0.2.0 Phoenix.LiveView.Controller View Source
The Controller for LiveView rendering.
Link to this section Summary
Functions
Renders a live view from a Plug request and sends an HTML response.
Link to this section Functions
Link to this function
live_render(conn, view, opts) View Source
Renders a live view from a Plug request and sends an HTML response.
Options
:session
- the map of session data to sign and send to the client. When connecting from the client, the live view will receive the signed session from the client and verify the contents before proceeding withmount/2
.
Before render the @live_view_module
assign will be added to the
connection assigns for reference.
Examples
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