This page covers Tutorial v2. Elm 0.18.


We need our update function to respond to the new OnLocationChange message.

In src/Update.elm add a new branch:

import Routing exposing (parseLocation)


update msg model =
    case msg of
        Msgs.OnLocationChange location ->
                newRoute =
                    parseLocation location
                ( { model | route = newRoute }, Cmd.none )

Here when we receive the OnLocationChange message, we parse this location and store the matched route in the model.

results matching ""

    No results matching ""