elixirphoenix-frameworkphoenix-live-view

Getting the current path in a LiveView


In a normal route:

get /index, MyController, :index

I can simply get the route from Plug.Conn's path_info function.

However if I have a live route, how do I retrieve the current path?

live /index, IndexLive


Solution

  • You can get the current uri using handle_params callback which is called after mount and before render.