当我尝试点击ng-repeat中某个元素中的链接时,ng-repeat中的所有链接都会被触发。检查相关问题但无法获得太多帮助。
PFB the plunker。 https://plnkr.co/edit/IZRulMaoyuS0GkWgXe7a?p=preview
<div class="content-main" ng-repeat="level in list.data.left">
<div class="content-flexbox-row">
<div class="content-first padding20">
<div class="approver-names margin25" ng-repeat="approver in list.data.left[$index]">
<div class="content-left-close"><i class="fa fa-times fa-2x" aria-hidden="true"></i></div>
<div class="approver-group">
<div class="group group-id">{{::approver.GroupId}}</div>
<div class="group group-name">{{::approver.Name}}</div>
</div>
<div class="group-image">
<i class="fa fa-smile-o fa-3x" aria-hidden="true"></i>
</div>
</div>
<div class="approver-names add-approver-hover" ng-click="autoComplete(this,$event, $index);" ng-if="flag==true">+ ADD SELECTOR</div>
<div ng-if="flag==false">test data </div>
</div>
<div class="content-second padding20">
<div class="approver-names">
<div>{{$index+1}}</div>
</div>
</div>
<div class="content-third padding20">
<div class="approver-names margin25" ng-repeat="endorser in list.data.right[$index]">
<div class="group-image">
<i class="fa fa-smile-o fa-3x" aria-hidden="true"></i>
</div>
<div class="approver-group">
<div class="group group-id">{{::endorser.GroupId}}</div>
<div class="group group-name">{{::endorser.Name}}</div>
</div>
<div class="content-right-close"><i class="fa fa-times fa-2x" aria-hidden="true"></i></div>
</div>
<div class="approver-names">+ ADD SELECTOR</div>
</div>
</div>
</div>
答案 0 :(得分:0)
您正在为ng-repeat中的所有项目使用唯一变量'flag'。
例如,你必须使用一组标志。