In the following Fiddle I would like to be able to set the selectedFruit when clicking on one of the fruits in the list however this does not appear to be working.
After clicking on a fruit, if I inspect the value of viewModel.selectedFruit in a Chrome immediate window it appears to set the value to the viewModel object rather than the bound data item. What am I doing wrong? It appears that there is a loss of context somewhere?
Thanks
Conclusion
Whilst this helped track down the problem I was experiencing in my main app, the underlying problem was that in haste I had forgotten to use the KO template foreach binding on my <UL> and was using the templ foreach instead.