Thoughts from the Wet Coast
The musings of an ASP.NET Developer from Canada's We(s)t Coast
Articles
So, in the last post on Knockout.js, I introduced the concept of Observable Arrays. Observable Arrays can respond to a change in the number of items in the collection (array).
Lets look first at Adding items to an observable array. Lets add a method to our ViewModel to add a task to the tasks array that we created in the previous post.
In previous posts in this series I introduced the concept of observables, and I referred to the concept of Observable Collections in Xaml (WPF and Silverlight) applications. Knockout also supports the concept of observable collections, although because JavaScript only has one collection type they are observable arrays.
Just as an observable responds to changes in an object, an observable array responds to a change in the number of items in the array. It tracks which objects are in the array - not the state of those objects.
Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.