O'Reilly logo

Getting Started with Knockout.js for .NET Developers by Andrey Akinshin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Observable arrays

Usual observables allow us to create some property for which Knockout.js detects any changes. However, what if we want to work with a collection of objects and detect add and remove operations? The Knockout.js solution is observable arrays. We can use this special kind of arrays with the help of ko.observableArray. In this section, we will discuss how to use it in general, how to add new elements in an observable array, how to remove elements, and some useful manipulation functions for observable arrays.

Using an observable array

Very often, the real ViewModel objects contain collections of some elements. In this section, we will consider a very simple example with a collection in the ViewModel to demonstrate observable array usage. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required