ng-repeat $ index不起作用

时间:2015-06-28 22:45:46

标签: html angularjs

我试图在ng-click函数中调用ng-repeat的$ index,但是没有调用$ index:

Pry.config.print = Proc.new { |output, val| output.puts "=> #{val.inspect}" }

open($ index)函数是没有正确调用$ index的地方。

<div class="row">
<div class="col-md-4 col-md-offset-4">
  <ul class="list-group">
    <div ng-repeat="bar in bars">
      <li class="list-group-item">
        <a ng-click="open($index)">{{bar.name}}</a>
        <span class="badge">{{bar.going}}</span>
      </li>
      <script type="text/ng-template" id="{{$index}}-barModal.html">
        <div class="modal-header">
          <h3 class="modal-title">{{bar.name}}</h3>
        </div>
        <div class="modal-body">
          <p>{{bar.location}}</p>
        </div>
        <div class="modal-footer">
          <button class="btn btn-primary" ng-click="going()">Going</button>
          <button class="btn btn-warning" ng-click="cancel()">Cancel</button>
        </div>
      </script>
    </div>
  </ul>
</div>

0 个答案:

没有答案