Genie Discord forum
Hello, I am trying to share different model variables to different route pages.
Say that i have a variable that is plot data on the main "/" page but i also want to use that data on a different route like "/plotpage". Currently i have the routes setup on the main page like....
module LaserPage include("LaserPage") end @page("/", ui) #model = Model |> init |> handlers route("/") do global model = @init #html(ui(model), context = @__MODULE__) page(model, ui()) |> html end module PrelimPage include("PrelimPage") end Server.up(async= true) end
Which just allow for different pages to be pulled up on the same IP but the variables are not shared.
In the laserpage.jl for example this is how it is routed
model = Model |> init |> handlers LaserModel = model route("/laser") do global LaserModel html(ui(LaserModel), context = @__MODULE__) end
Which is great when i dont need variables to be global across multiple pages.
You can use same model for multiple pages?
I can use the same model but I want an observable written on one page to be available on another page with a different model.