Maybe it will help you to know that I always return top level messages from
my views. Like this:
input
[ type_ "checkbox"
, checked form.queryAssignedOnly
, onCheck (Msg.PayoutList << PayoutMsg.UpdateQueryAssignedOnly)
]
Just for the record, the (Msg.PayoutList <<
PayoutMsg.UpdateQueryAssignedOnly)produces a new function, when called it
will invoke PayoutMsg and the result will be applied to Msg (top level).
Or another example from the same form:
[ button
[ type_ "button"
, onClick
(if RemoteData.isFailure form.list then
Msg.Reload
else
Msg.PayoutList PayoutMsg.RefreshForm
)
This button will either refresh my form using local PayoutMsg.RefreshForm or
it will call top-level Msg.Reload when errors were encountered previously.
Regards,
Witold Szczerba
On Tue, Apr 25, 2017 at 2:02 PM, Vardhan <[email protected]> wrote:
> Hi,
> On Monday, April 24, 2017 at 10:54:28 PM UTC+5:30, Erik Lott wrote:
>>
>> Whoops. Html.map is correct...
>>
>
> Thanks for the answers. However I later ``discovered`` that the top Msg
> will have to include a id too ,
> type Msg = ItemMsg IDType ItemMsg
> .. so things got more complicated.
> I guess i'll make flat app first, and them extract models.
>
> -Thanks
> Vardhan
>
>
>
>> view : Model -> Html Msg
>> view model =
>> div []
>> (model.items
>> |> List.map itemView
>> |> List.map (Html.map ItemMsg)
>> )
>>
>> On Sunday, April 23, 2017 at 1:49:22 PM UTC-4, Max Goldstein wrote:
>>>
>>> Yes, Ian is correct.
>>>
>>> Html.Attributes.map
>>> <http://package.elm-lang.org/packages/elm-lang/html/2.0.0/Html-Attributes#map>
>>> :
>>> (a -> msg) -> Attribute a -> Attribute msg
>>>
>>> Html.map
>>> <http://package.elm-lang.org/packages/elm-lang/html/2.0.0/Html#map>: (a
>>> -> msg) -> Html a -> Html msg
>>>
>>
> On Monday, April 24, 2017 at 10:54:28 PM UTC+5:30, Erik Lott wrote:
>>
>> Whoops. Html.map is correct...
>>
>> view : Model -> Html Msg
>> view model =
>> div []
>> (model.items
>> |> List.map itemView
>> |> List.map (Html.map ItemMsg)
>> )
>>
>> On Sunday, April 23, 2017 at 1:49:22 PM UTC-4, Max Goldstein wrote:
>>>
>>> Yes, Ian is correct.
>>>
>>> Html.Attributes.map
>>> <http://package.elm-lang.org/packages/elm-lang/html/2.0.0/Html-Attributes#map>
>>> :
>>> (a -> msg) -> Attribute a -> Attribute msg
>>>
>>> Html.map
>>> <http://package.elm-lang.org/packages/elm-lang/html/2.0.0/Html#map>: (a
>>> -> msg) -> Html a -> Html msg
>>>
>> --
> 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.
>
--
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.