Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Animation logic triggering an unnecessary $rootScope.$digest if ng-if is present #15322

Closed
@poshest

Description

@poshest

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions