.div(ng-repeat='item in items')
button(id='ID{{$index}}') No Hi
button(id='anotherID1') Hi
関連する Angular ディレクティブ内
$('#ID1').on('click', function() {alert('hi');}); // does not work
$('#anotherID1').on('click', function() {alert('hi');}); // works
ng-repeat 要素に一意の ID が必要な DOM 操作を実行しています。DOM 操作を他の方法でも実行できるかどうかも提案してください。
編集: @timeJV:-
style.
.ques {
height: 50px;
overflow:hidden;
}
<div ng-repeat='item in items'>
<div class='ques'> {{item.ques}}
</div>
<button id='ID{{$index}}'> No Hi </button>
</div>
// ディレクティブ コード:- の高さを増やす<div class = 'ques'>