Created
July 15, 2016 19:38
-
-
Save davoclavo/7ba3738e7c3d144d276657e0ea99958f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Html exposing (Html, input, text, div) | |
import Html.App exposing (beginnerProgram) | |
import Html.Attributes exposing (type') | |
import Html.Events exposing (on, targetValue, onInput) | |
import Json.Decode as Json | |
type alias Model = | |
{ value : String | |
} | |
main = | |
beginnerProgram | |
{ model = {value = "50"} | |
, view = view | |
, update = update | |
} | |
type Msg = Slide String | |
view : Model -> Html Msg | |
view model = | |
div [] | |
-- [ input [type' "range", on "input" (Json.map Slide targetValue)] [] | |
[ input [type' "range", onInput Slide] [] | |
, text model.value | |
] | |
update : Msg -> Model -> Model | |
update msg model = | |
case msg of | |
Slide v -> | |
{ model | value = v} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment