On Mon, Dec 5, 2016 at 8:38 PM, Wouter In t Velt <[email protected]>
wrote:
> Looks great! I would suggest a small change in the country update: to only
> reset the city selector if the country selected is different from the
> previous selection.
>
> CountryPicked country ->
> { model
> | country = Just country
> , city =
> if model.country /= Nothing && model.country /= Just
> country then
> Nothing
> else
> model.city
> }
>
>
You cannot use comparison on tags. But I have updated the code to reflect
the requested functionality. It looks like:
CountryPicked country ->
{ model
| country = Just country
, city =
model.country
|> Maybe.andThen
(\currentCountry ->
if currentCountry == country then
model.city
else
Nothing
)
}
--
There is NO FATE, we are the creators.
blog: http://damoc.ro/
--
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.