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.

$animate.removeClass() doesn't work if addClass animation incomplete #7222

Closed
@greglockwood

Description

@greglockwood

Request Type: bug

How to reproduce:

  • Use $animate.addClass() to add a class to an element, e.g. 'super'
  • While the 'super-add' class has been added to the element, and before the 'super' class has been added, use $animate.removeClass() to remove the 'super' class.
  • When the jqLiteRemoveClass() function is called to remove the 'super' class, it will not be removed due to the element not having that class yet.
  • In the next tick, the 'super-add' class will be removed from the element, and the 'super' class is added, even though it was requested to be removed.

Component(s): ngAnimate, jqLite

Impact: medium

Complexity: small

Detailed Description:

The way I got this to occur was by using ng-class with the object syntax where the condition for one of the classes was initially true but then became false (possibly within the same $digest, I'm not sure). Hence the class was first added but then (unsuccessfully) removed.

I would imagine that the solution would be to check for active 'addClass' animations when trying to remove classes and if there is one for the class to be removed, cancelling it.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions