I have an array which just have values in following format:
var myArray = [ "Value1", "V1lue2" ,"Value3","a1lue4" ]
Now I want to loop through them and add them to UL like below:
<ul data-bind="foreach:myArray">
<li>
<span data-bind="text: $value"> </span>:
</li>
</ul>
I checked knockout documentation which have examples with name value JSON , but not from direct array.
Example:
<ul data-bind="foreach: people">
<li>
Name at position <span data-bind="text: $index"> </span>:
<span data-bind="text: name"> </span>
<a href="#" data-bind="click: $parent.removePerson">Remove</a>
</li>
</ul>
How do I loop through myArray
and apply binding to current UL?