Thanks. I ran your example with elm-reactor and it worked, so at least I
could be sure it wasn't elm's fault.
But the code wasn't significantly different than mine. So I started
stripping code out of my program to identify the source of the problem.
Stripped it down to nothing without success. But I was hosting it on an
ASP.NET MVC development server. So I finally ran the simple version with
elm-reactor and it worked from elm-reactor but not from ASP.NET MVC hosted
webpage.
I finally found that the problem was coming from how I was loading the elm
script in the ASP.NET page.
I had been loading the elm script with this line:
@Scripts.Render(System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/bundles/distjs",
true))
instead of
@Scripts.Render("~/bundles/distjs")
Which has the nice effect of letting me simply reload the webpage to update
my elm script, instead of restarting my server. But it has the downside of
breaking certain aspects of Elm's rendering process. Was extremely weird
and hard to pin down.
Chris
On Tuesday, December 27, 2016 at 7:16:30 PM UTC-5, Duane Johnson wrote:
>
> Using your code snippet, I created a project that changes the text value,
> as you would expect it to do. Is my code set up differently than yours?
>
> https://github.com/canadaduane/elm-dd
>
> Initial state and "after clicking" state images are attached.
>
> -- Duane
>
>
>
>
> On Tuesday, December 27, 2016 at 4:02:28 PM UTC-7, Chris Van Vranken wrote:
>>
>> I am trying to render a text
>> <http://package.elm-lang.org/packages/elm-lang/html/2.0.0/Html#text>field
>> with Elm 0.18. The text is wrapped in a div and I need to re-render it
>> when my model changes. It will not update after the initial render, so its
>> initial value is always displayed even though the class of the div updates
>> properly and the style obviously changes. If I change the Html.text to
>> Html.input and set the input's value then the value changes are displayed
>> properly (but the styling is horrible). The Debug.log output also makes it
>> seem like it should be working. I would think Html.text is pretty
>> ubiquitous, so this seems like a silly question...but is Html.text working
>> properly in 0.18? Any ideas why this isn't working for me? Thanks, Chris.
>>
>>
>> My code comes from this example
>> <https://github.com/r31gN/elm-dropdown/blob/master/Example/Example.elm> and
>> looks like the following
>>
>> renderDropdownValueHtml : Dropdown -> Html Msg
>> renderDropdownValueHtml model =
>> let
>> isPlaceHolder =
>> (String.length model.value) == 0
>>
>> dropdownValue =
>> if isPlaceHolder then
>> Debug.log "Render PlaceHolder" model.placeholder
>> else
>> Debug.log "Render Value" model.value
>> in
>> div
>> [ class <|
>> if isPlaceHolder then
>> "elm-dropdown__value is--placeholder"
>> else
>> "elm-dropdown__value"
>> , onClick ToggleDropdown
>> ]
>> [ text dropdownValue
>> ]
>>
>>
>>
>>
--
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.