Since a
tag can be always used with specified href
, I'd rather try to find a solution which would avoid using redirection from update
function.
a [ href "http://google.com" ] [ text "Google link" ]
But in case it's necessary to implement the logic similar to window.location.href = "http://google.com";
, elm-lang/navigation
provides load function (and a couple of other useful ones for forcing page loads) which does, what you're expecting.
It takes a url and returns a command load : String -> Cmd msg
, so it's going to look like this:
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
RedirectToGoogle ->
( model, load "http://google.com" )