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.

ngClass in 1.2.0-rc1 with animations awkward #3587

Closed
@OverZealous

Description

@OverZealous

I think the animating of ngClass doesn't make sense. With 1.2.0-rc1, adding or removing a class works in a completely non-intuitive manner. Before it was easy to use class adding and removal to perform simple CSS-based animations: add a class, handle the CSS changes in the CSS. No problem.

Now, however, ngAnimate ends up waiting to add the new class until the animation has run, then applies the new class, then the actual animation happens. As an example, assume you had this:

.foo {
    color: white;
    transition: 5s ease all;
}

.foo.active {
    color: red;
}

And in your view:

<span class="foo" ng-class="{active: fooEnabled}">Hello World</span>

Previously, the color would animate immediately upon setting fooEnabled to true. Now, there's a 5 second pause, then the animation occurs.

As a workaround, I've found that you can set the class on a parent object, and only have the transition on a child, but this is really impractical.

I think there either needs to be a way to prevent ngClass from animating or disable animations on ngClass altogether. It really doesn't make sense to add animations to ngClass, though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions