Closed cknightdevelopment closed 8 years ago
The two-way binding somehow causes this issue. With value.one-way="person.name"
instead of value.bind="person.name"
it works fine.
@cknightdevelopment - you're not doing anything wrong- it's this issue: https://github.com/aurelia/binding/issues/205
Here is the relevant code for the issue I am experiencing:
JS
HTML
Note: I have a plunker to help illustrate this issue (takes a few seconds to load in plunker)
As you can see I have two simple
if.bind
's checking ifperson
is truthy. If it is, the person's name is displayed in a textbox and as part of an message, otherwise the textPerson is null
is displayed. When I click the button, I set theperson
object to null via themakeNull()
method. However, the textbox and message are still displayed (even though the value ofperson.name
is correctly updated in the UI?). When I click the button a second time, theif.bind
's seem to pick up the change and thePerson is null
text is displayed. It is worth noting that if I remove the textbox (<input type="text" value.bind="person.name" />
), everything works fine.I would expect everything to work on the first button click (first time setting
person
to null). Am I doing something wrong or against convention? Is this a bug? Let me know if I can provide more information.