You are on the right track. But you forgot to output () in both of your examples.
myArray is an observable array and $index is observable, so they are functions, so you need to call them as functions using () to get their values ββinside the expressions.
So the correct bindings are:
<span data-bind="text: $data, visible: $index() == 0"></span>
and
<span data-bind="text: myArray()[0]"></span>
JSFiddle demo.
Note. If you really want to display the first element, you should prefer the text: myArray()[0] version, because what you are trying to do is much cleaner there.
source share