I’m trying to bind a <ul> element to a property that is an observableArray. The <ul> does get bound when the view model already has some entries in the array. But when i dynamically add entries to the property it does not update the UI.
I created an example at: http://jsfiddle.net/shardul/SZWPT/
I’m just getting started with Knockout and can’t figure out what I’m doing wrong?
Here is a corrected fiddle: http://jsfiddle.net/jearles/SZWPT/3/
The line I corrected was:
When you were doing
this.nameList().pushyou were manipulating the array inside the observableArray, which does not automatically notify listeners of changes. By pushing to the observableArray itself listeners are immediately notified and the UI will refresh.