1
두 개의 ng-repeat에 대해 숫자를 연속적으로 생성해야하는데 ($index
을 사용하고 있지만 다시 두 번째로 1에서부터 시퀀스를 부여합니다) ng-repeat
. 범위에서 변수를 가져 와서 뷰에서 증가 시키려고했으나 해결되지 않았습니다.두 개의 ng-repeat에서 순차적으로 번호를 생성합니다.
코드 :
<body ng-controller="MainCtrl">
<ul ng-repeat="detail in details">
<li><span>{{$index + 1}}</span><span> {{detail.name}}</span>
</li>
</ul>
<ul ng-repeat="detailed in details.name">
<li><span>{{$index + 1}}</span><span>{{detailed.prof}}</span></li>
</ul>
</body>
컨트롤러 : 여기 plunker 엔지니어 번호
app.controller('MainCtrl', function($scope) {
$scope.details = [
{ "name": "Employees" },
{ "name": "Support" }
];
$scope.details.name = [
{ "prof": "enginerr" },
{ "prof": "doctor" }
];
});
3이어야하며 의사의 수는 4
어떤 도움 것이되어야한다 감사하겠습니다.