간단한 사용자 정의 페이지 매김을 만들고 싶지만 ngRepeat의 두 반복 사이에 구분 기호를 지정하는 방법을 모르겠습니다. 현재 구분 기호는 끝과 끝 사이에 있습니다.각도 CSS ngRepeat with separator between li
function Controller($scope)
{
$scope.currentPage = 1;
$scope.totalPages = 2;
$scope.itemPerPage = 12;
$scope.getPages = function()
{
return new Array($scope.totalPages);
};
$scope.pageChange = function (page)
{
if(isNaN(page))
{
if((page == "-" && 1 < $scope.currentPage) || (page == "+" && $scope.currentPage < $scope.totalPages))
{
$scope.currentPage = eval($scope.currentPage + page + 1);
}
}
else
{
$scope.currentPage = page;
}
};
}
ul
{
list-style: none;
display: inline-block;
vertical-align: middle;
margin-bottom: 0;
}
li
{
display: inline-block;
vertical-align: middle;
margin: 0 -1px;
}
a.active
{
background: #31a445;
color: #fff;
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="" ng-controller="Controller">
<ul>
<li ng-repeat="page in getPages() track by $index">
<a href="" ng-click="pageChange($index + 1)" ng-class="{active: currentPage == $index + 1}">{{$index + 1}}</a>
</li>
<li ng-hide="$last" class="paging-spacer"><span>-</span></li>
</ul>
</div>
ng-repeat-start
를 사용해야합니다
은 인'html' 하나의'span'보다 더 복잡 할가는 "스페이서"내부? '$ last''li' – haxxxton