Elm-spa.dev -- how to access global model in a page view?

Hi,

I’m learning https://www.elm-spa.dev and find it very helpful to understanding how to set up multi-page apps in Elm.

I do have one question – if I want to access data in the global model in a page view, how do I do that?

For example:

only the page model is passed into the view. Is there any way to access the global model, or am I thinking about this wrong?

Thanks,
Cliff

cc: @RyanNHG

1 Like

Remove the always function from line 41, then you have access to PageContext and can use the view this way:

view : Utils.Spa.PageContext → Model → Element Msg
view { global, route, queryParameters } model =

ahh yes, and it is documented, which I missed:

Thanks a lot!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.