Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS ng-click event is not firing when inside nested ng-repeat

I have problem with ng-click (I'm using angular 1.0.4). First ng-click works but second no.

    <div class="menu-group" ng-repeat="module in modules">
         <div ng-click="toggle($event, $parent)" class="group-head">{{module.group.name}} <span class="{{module.group.icon}}"></span></div>
         <ul class="menu collapsed" ng-init="items = module.group.items">
              <li ng-repeat="item in items" ng-click="openCategory($event, '{{item.name}}')">{{item.display}}</li>
         </ul>
    </div>

Generated code looks good:

    <li ng-repeat="item in items" ng-click="openCategory($event, 'simpleName')" class="ng-scope ng-binding">Simple name</li>
like image 788
miru87 Avatar asked Jan 25 '13 11:01

miru87


1 Answers

Instead of '{{item.name}}' just use item.name

Demo: http://plnkr.co/edit/QNKZDT9N5k2tQaRrFlwY?p=preview

like image 51
SunnyShah Avatar answered Sep 28 '22 01:09

SunnyShah