Mario, just keep a Material.Model in the model of each sub-page. On Friday, September 2, 2016 at 6:18:55 PM UTC-4, Mario Sangiorgio wrote: > > Hello everybody, > > I've been experimenting for a while with elm. Previously I tried plain elm > and I found it very effective to have a module for each sub-page of my > applications and a root module holding everything together. > > I'm trying to follow the same approach with an app using elm-mdl but I > found this model is clashing a bit with the fact that elm-mdl requires to > pass an instance of Material.Model to some of the rendering function and > wants a custom message. > > I’d normally have the classic `view : Model -> Html Message` function and > in the root module I’d put everything together doing `Html.App.map > MyPageMessage <| MyPage.view model.myPage`. > > elm-mdl changes this a bit and it makes it hard to follow the same > pattern. I can make this work with a more convoluted view function but it > feels less clean than using `Html.App.map`. The signature of the view > method on my pages would be something like > > view : Material.Model -> (Material.Msg a -> a) -> (Message -> a) -> Model > -> Html a > > That way I can inject the mdl model, the constructor to create the > root-level messages (which include the MdlMessage). > > I suspect there is a better approach but I'm struggling to find it. > What are the patterns you use with elm-mdl? > > Thanks, > Mario >
-- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
