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

$animateProvider.classNameFilter removing class name for leave event that follows an enter event #11431

Closed
codeniac opened this issue Mar 25, 2015 · 2 comments

Comments

@codeniac
Copy link

I'm building a notification system and i set

$animateProvider.classNameFilter(/ng-animate/);

to prevent conflict with other components in website. When the animation comes in everything work fine, and ng-enter class provide the animation, but it seems that filter class ng-animate is removed from the div and hence the ng-leave class is not been applied!! With you duplicate the ng-animate class in the component you can work around the problem!! Check out this plunker to see what i'm talking about: http://plnkr.co/edit/7IEgccUvteHFCGiML6Fy?p=preview

The bounce in animation works fine when enter, but when leaving it does not trigger the bounce out animation!

@matsko
Copy link
Contributor

matsko commented Apr 20, 2015

Turns out that ng-animate is actually used internally within Angular to track the animation. This is actually still present in 1.4. I'll look to see if we can fix it so it doesn't cause ngLeave to fail.

In the meantime please do use a different className filter value other than ng-animate.

@matsko matsko added this to the 1.4.x - jaracimrman-existence milestone Apr 20, 2015
@matsko matsko self-assigned this Apr 20, 2015
matsko added a commit to matsko/angular.js that referenced this issue May 5, 2015
…ilter

Since ngAnimate uses the `ng-animate` CSS class internally to track
state it is better to keep this as a reserved CSS class to avoid
accidentally adding / removing the CSS class when an animation is
started and closed.

BREAKING CHANGE: partially or fully using a regex value containing
`ng-animate` as a token is not allowed anymore. Doing so will trigger a
minErr exception to be thrown.

So don't do this:

```js
// only animate elements that contain the `ng-animate` CSS class
$animateProvider.classNameFilter(/ng-animate/);

// or partially contain it
$animateProvider.classNameFilter(/some-class ng-animate another-class/);

// but this is OK
$animateProvider.classNameFilter(/ng-animate-special/);
```

Closes angular#11431
@matsko
Copy link
Contributor

matsko commented May 5, 2015

@codeniac since the ng-animate CSS class is used internally within $animate, having to special case whether the element uses it or not can lead to problems. Therefore the decision is to have $animate raise an issue if your classNameFilter value contains a regex which matches it.

This PR sets the enforcement into place:
#11807

You'll need to use a different CSS class to special case your "allowed" animations. Sorry for posing a breaking change on your code. Hopefully it won't involve lots of changes.

matsko added a commit to matsko/angular.js that referenced this issue May 5, 2015
…meFilter

Since ngAnimate uses the `ng-animate` CSS class internally to track
state it is better to keep this as a reserved CSS class to avoid
accidentally adding / removing the CSS class when an animation is
started and closed.

BREAKING CHANGE: partially or fully using a regex value containing
`ng-animate` as a token is not allowed anymore. Doing so will trigger a
minErr exception to be thrown.

So don't do this:

```js
// only animate elements that contain the `ng-animate` CSS class
$animateProvider.classNameFilter(/ng-animate/);

// or partially contain it
$animateProvider.classNameFilter(/some-class ng-animate another-class/);

// but this is OK
$animateProvider.classNameFilter(/ng-animate-special/);
```

Closes angular#11431
@matsko matsko closed this as completed in 1002b80 May 7, 2015
netman92 pushed a commit to netman92/angular.js that referenced this issue Aug 8, 2015
…meFilter

Since ngAnimate uses the `ng-animate` CSS class internally to track
state it is better to keep this as a reserved CSS class to avoid
accidentally adding / removing the CSS class when an animation is
started and closed.

BREAKING CHANGE: partially or fully using a regex value containing
`ng-animate` as a token is not allowed anymore. Doing so will trigger a
minErr exception to be thrown.

So don't do this:

```js
// only animate elements that contain the `ng-animate` CSS class
$animateProvider.classNameFilter(/ng-animate/);

// or partially contain it
$animateProvider.classNameFilter(/some-class ng-animate another-class/);
```

but this is OK:

```js
$animateProvider.classNameFilter(/ng-animate-special/);
```

Closes angular#11431
Closes angular#11807
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants