Animation logic triggering an unnecessary $rootScope.$digest if ng-if is present #15322
Description
In this Plunker, there's a $scope.$apply()
because of the ng-click
as expected. But then, follows an $evalAsync
which calls another, I would argue unnecessary $rootScope.$digest()
.
It seems to happen because of the presence of the ng-if
in
<b ng-if="toggle">toggled</b>
And only happens when toggle
evaluates to false
, removing the element.
It doesn't happen if the ng-if
is changed to ng-show
. It seems to be caused by some core Angular animation functionality, involving functions like $$AnimateAsyncRunFactoryProvider
, whose waitQueue
appears to originate the $evalAsync
. I'm not sure what fed the waitQueue
in the first place. Although there is animation code involved, this problem occurs whether or not ng-animate
is included.
It seems to have appeared in the 1.4.x series. No extra digest happens using v1.3.20.
This is causing many additional digest cycles in my app that I would love to not have.