An observableArray is a knockout.js construct similar to a regular array in JavaScript, except that it allows for observing changes to the collection (e.g. adding and removing items).
An observableArray is a knockout.js construct similar to a regular array in JavaScript, except that it allows for observing changes to the collection (e.g. adding and removing items).
To quote the introduction from the relevant knockout.js documentation:
If you want to detect and respond to changes on one object, you’d use observables. If you want to detect and respond to changes of a collection of things, use an
observableArray. This is useful in many scenarios where you’re displaying or editing multiple values and need repeated sections of UI to appear and disappear as items are added and removed.var myObservableArray = ko.observableArray(); // Initially an empty array myObservableArray.push('Some value'); // Adds the value and notifies observersTo see how you can bind the observableArray to a UI and let the user modify it, see the simple list example.
Key point: An observableArray tracks which objects are in the array, not the state of those objects.
 
     
     
     
     
     
     
     
     
     
     
     
     
     
    