私はng-repeatを別のng-repeatの中に持っており、すべてのレコードの大域的な数を計算できる必要があります。関数の返り値ng repeat with ng repeat with function angularJS
ng-repeat内のビューで変数を宣言して追加しても動作しないようにしようとしました。
私は現在以下のコードを持っています。
<body ng-app="app">
<div class="table-responsive" ng-controller="quotesController">
<div ng-repeat="info in datos2 track by $index">
<h2><strong>{{info.name}}</strong></h2>
<div ng-init='count()' ng-repeat="dato in data track by $index">
<span>{{dato.name}}</span>
<br> Position {{id}}
<br />
</div>
</div>
</div>
</body>
コード角度
$scope.count=function(){
number = number + 1;
$scope.id=number;
}
私は私にそれがある数の位置をもたらすために、すべてNGリピートのクエリーを必要としています。
例:
名1つの項目1 - 位置1
ITEM 2 - 位置2
名2、項目1ポジション3
ITEM 2 - 位置4
名前3項目1 - 位置5
ITEM 2 - ポジション6
http://plnkr.co/edit/I5IWOXGmzbu0UNqn04ha?p=preview
は私の答えを編集しました。オリジナルは同じ位置価値を持つすべてのアイテムを持っていました。 –
を見てくださいhttps://docs.angularjs.org/error/$parse/ueoe?p0=totalCount%2B%2B –
@JCFordすでに 'ng-init = 'count()''があります。動作しません:http://plnkr.co/edit/6xTnOc9KOxpB4gEDE1lA?p=preview –