AngularJS - ng-show in ng-repeat 사용
ng-반복 블록 내에서 ng-show 지시를 사용하는 데 문제가 있습니다.
부울 값이 ng-show에 올바르게 전달되지 않는 것 같습니다...
제가 JSFiddle에서 만든 예제의 스크린샷을 보여드리겠습니다.
마크업의 예시는 다음과 같습니다.
<table ng-controller="ActressController" class="table table-bordered table-striped">
<tr ng-repeat="actress in actressList">
<td>
<span class="actress-name">{{ actress.name }}</span>
<h4 ng-show="{ actress.name == 'Scarlett' }">Was in Avengers! <span class="note">(should only appear if Scarlett)</span></h4>
<h2>{{ actress.name == 'Scarlett'}} <span class="note"><-- this statement is correct</span></h2>
</td>
</tr>
</table>
컨트롤러의 예는 다음과 같습니다.
function ActressController($scope) {
$scope.actressList = [
{
name: "Angelina"
}, {
name: "Scarlett"
}, {
name: 'Mila'
}, {
name: 'Megan'
}
]
}
내가 뭘 잘못하고 있는지에 대한 생각이 있습니까?
당신의ng-show
{}이(가) 필요하지 않습니다.
<h4 ng-show="actress.name == 'Scarlett'">Was in Avengers! <span class="note">
작업 샘플에 대해서는 이 fiddleng-show
일 이내에ng-repeat
.
언급URL : https://stackoverflow.com/questions/12979532/angularjs-using-ng-show-within-ng-repeat
'programing' 카테고리의 다른 글
특정 값을 가진 해시 테이블 키를 얻는 방법은? (0) | 2023.10.22 |
---|---|
C - R 프로그래머의 경우 - 기본을 초과한 경우 권장 리소스/접근 방법 (0) | 2023.10.22 |
jQuery - 기본값을 방지한 다음 기본값을 계속합니다. (0) | 2023.10.22 |
Perf 캐시 이벤트란 무엇을 의미합니까? (0) | 2023.10.22 |
일부 매크로의 출처를 찾는 방법 (0) | 2023.10.22 |