This is a migrated thread and some comments may be shown as answers.

Value Changed in ViewModel not Reflected in View

1 Answer 125 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 05 Feb 2014, 04:54 PM
I have a very simple example setup where I want to change a viewmodel value inside a function using click binding. It looks like the viewmodel value is getting changed but the view is never updated.

Here is the example:

http://jsfiddle.net/MuFP5/2/

1 Answer, 1 is accepted

Sort by
0
Paul
Top achievements
Rank 1
answered on 05 Feb 2014, 05:35 PM
I figured out what was wrong. When changing a viewModel value in the event, I have to use "set" instead of just setting the value equal to the new value. 

I had to do this:

this.set("slideVisible", !this.slideVisible);

instead of:

this.slideVisible = !this.slideVisible;
Tags
MVVM
Asked by
Paul
Top achievements
Rank 1
Answers by
Paul
Top achievements
Rank 1
Share this question
or