0

I am using angular ui drop down element

<div class="dropdown" >
          <a  ng-click="getTypes();" dropdown-toggle>  Add a Type</a>
             <ul class="dropdown-menu">
                <li ng-repeat="type in Types"><a><b>{{type.sType }}:</b><em>{{type.sDescription}}</em></a> </li>
             </ul>
        </div>

all that i do is call a web service and populate Types all works fine! But when i add the above code in my htm the div below it starts throwing the exception of max digest reached.

the div below the drop down code(as written above) simply consists of few editable segments with icons and their visibility is controlled by ng-show and ng-hide when the use click a button

say on click of 1st segment i set a variable to true by using ng-click and depending on this variable i show or hide segments by using ng-show and ng-hide

so my doubt is that without the drop down code written above my ng-show and ng-hide work completely fine but the moment i try to use the drop down directive of angular ui i start getting this exception when i click on the buttons . please help.

Edit below is the code which follows basically user clicks on icons to reorder the elements that are appearing in the ng-repeat list and from the drop down which is above the user can add elements to this list

<ul class="repeatList text-center">
                <li ng-repeat="widgets in leftWidgets" widget widgets="widgets" 
                    class="wArea">
                    <a href="" class="icon-remove-circle pull-right" ng-show="editMode" ng-click="deleteWidget(leftWidgets);"
                        title="Delete Widget">
                    </a>
                    <a href="" class="icon-chevron-up slideUpIcon" ng-click="shiftUp(widgets,leftWidgets);"
                        ng-show="editMode">
                    </a >
                    <a href="" class="icon-chevron-down slideDownIcon" ng-click="shiftDown(widgets,leftWidgets);"
                        ng-show="editMode">
                    </a>
                </li>
            </ul>
Rishul Matta
  • 3,383
  • 5
  • 23
  • 29
  • please provide more code, from what you posted I think can't find the issue. You can use this template in Fiddle: http://jsfiddle.net/9Ymvt/878/ – Maxim Shoustin Dec 18 '13 at 11:58
  • This issue is the "infinite loop" of angularJS. Somehow angularJS loops into the controller over and over, but as said above pieces of code are missing here. – bdavidxyz Dec 18 '13 at 16:15
  • [Nice post on the issue](http://stackoverflow.com/questions/17116114/how-to-troubleshoot-angular-10-digest-iterations-reached-error) i read the above post and kept doing hit and trial and found that using empty anchor tags was causing the problem. i.e. i had attached ng-click events to ** text ** tags the moment i changed them to span all worked fine! – Rishul Matta Dec 19 '13 at 06:18
  • thanks @MaximShoustin for the fiddle it assured me that nothing is wrong in the above code – Rishul Matta Dec 19 '13 at 06:24

1 Answers1

0

kept doing hit and trial and found that using empty anchor tags was causing the problem. i.e. i had attached ng-click events to

<a href="" ng-click="handler();"> text </a>   //empty href

the moment i changed them to span all worked fine! dont know why the empty "a" tags caused the problem but it will be great if any one can shed some light on the reasons for the above run time angular js exception. the link below is a useful

How to Troubleshoot Angular "10 $digest() iterations reached" Error

thanks!

Community
  • 1
  • 1
Rishul Matta
  • 3,383
  • 5
  • 23
  • 29