반응형
각도, 한계값 대상 및 $index별 추적
필터링을 통해 들어오는 개체를 제한하려고 하는데(모든 개체를 표시하는 옵션이 있기 때문에), 제한 대상 및 인덱스로 추적하려고 하면 문제가 발생합니다.코드는 다음과 같습니다.
<div ng-repeat="item in filter.values track by $index | limitTo:filterLimit" class="cengage-builder-result-filter-value" value="item" update-filter="updateFilter">
컨트롤러 내:
$scope.filterLimit = 5;
앵글 에러에 속았다고 쓰여있어서 $index에 의한 트랙이 여기서 작동하지 않는 것 같아요.제대로 된 방법을 못 찾겠어요 도움이 필요해요감사합니다!
필터, 예를 들어limitTo,orderBy등...앞에 와야 한다track by어레이 소스에 적용되기 때문에track by표현.
<div ng-repeat="item in filter.values | limitTo:filterLimit track by $index">
이 사용법을 시험해 보다limitTo전에track by
<div ng-repeat="item in filter.values | limitTo:filterLimit track by $index" class="cengage-builder-result-filter-value" value="item" update-filter="updateFilter">
언급URL : https://stackoverflow.com/questions/30201046/angular-limitto-and-track-by-index
반응형
'programing' 카테고리의 다른 글
| Spring Boot 2.0에서 자체 서명 증명서를 사용한HTTPS 사용 (0) | 2023.03.21 |
|---|---|
| WordPress add_rewrite_rule은 로컬로 동작하지만 서버에서는 동작하지 않습니다. (0) | 2023.03.21 |
| React.render() 내의 여러 요소를 반환합니다. (0) | 2023.03.21 |
| tsconfig.json 경로 사용 방법 (0) | 2023.03.21 |
| Angularjs - DOM이 로드될 때까지 내용 숨기기 (0) | 2023.03.21 |