title: How to use index in computed observable [knockout.js]
body: <p>Below is some example code. I need to use the items index in a computed variable, but I cant figure out how to do it without accessing the variable holding the view model app.</p>
  
  <pre><code>&lt;template type="text/ko-template" id="rowTemplate"&gt;
      &lt;li&gt;&lt;span data-bind="text: number"&gt;&lt;/span&gt; = &lt;span data-bind="text: word"&gt;&lt;/span&gt;&lt;/li&gt;
  &lt;/template&gt;
  
  &lt;ul data-bind="template: { name: 'rowTemplate', foreach: rowArray }"&gt;&lt;/ul&gt;
  
  &lt;script&gt;
  
      function RowModel(word) {
          var self = this;
          self.word = ko.observable(word);
          self.number = ko.computed({
              read: function(){
                  return "#" + app.rowArray.indexOf(self); // This works, but is far from ideal.
              },
              deferEvaluation: true
          });
  
      };
  
      function ViewModel() {
          var self = this;
          self.rowArray = ko.observableArray([
              new RowModel('Zero'),
              new RowModel('One'),
              new RowModel('Two'),
          ]);
      };
  
      var app = new ViewModel();
      ko.applyBindings(app);
  
  &lt;/script&gt;
  </code></pre>
  
  <p>I've tried changing the line with the comment to many things, such as <code>$index</code>, <code>self.index()</code>, and all similar combos with <code>$parentContext</code>, etc.</p>