KnockoutJS Observable Array – KnockoutJs provides Observable Array(observableArray) to detect and respond to changes in a collection of things. Sometimes we need to reflect the changes to UI when working with multiple values like adding new values, editing new values or deleting the values. Here in this tutorial we are going to explain how you can use Observable Array in KnockoutJS with example and demo.
KnockoutJS Observable Array Example
Let us understand how Observable Array works-
Syntax
You can initialize empty array simple as below-
KnockoutJS Observable Array Example:
var myObservableArray = ko.observableArray(); // Initialize empty array |
Example
Now let us create a simple example of observableArray
Observable Array Example:
<title>KnockoutJS Example</title> <div> </div> |