I have an observable array:
var myObservableArray = ko.observableArray([
{ name: "Car", price: "9999" },
{ name: "Shoes", price: "20" },
{ name: "Paper", price: "1" }
]);
I'm trying to access the price of the first item in the array.
<div data-bind="text: myObservableArray()[0]"></div>
Displays:
[object Object]
I've tried:
<div data-bind="text: myObservableArray()[0].price"></div>
But that just returns a null.
What's the correct syntax for doing this?
Edit: Fixed a copy and paste error pointed out below.