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

ngAnimate not preserving classes in nested directives with 'replace' set to true #3940

Closed
sbaldwin621 opened this issue Sep 9, 2013 · 3 comments

Comments

@sbaldwin621
Copy link

Decided to try updating to Angular 1.2rc2 so that I could try out the new ngAnimate. However, just including the module in my app broke a bunch of my styling.

Turns out that some of my elements were now missing their classes. These were all transcluded elements with directives with 'replace' set to true. Normally, those classes are preserved and copied onto the new element. With ngAnimate included, they go missing.

Here's a reduction of the problem: http://plnkr.co/edit/H2vUyI?p=preview

I've tracked down the problem to the following lines in animate.js:

        if ((parent.inheritedData(NG_ANIMATE_STATE) || disabledAnimation).running) {
          //avoid calling done() since there is no need to remove any
          //data or className values since this happens earlier than that
          //and also use a timeout so that it won't be asynchronous
          $timeout(onComplete || noop, 0, false);
          return;
        }

Seems like this was changed from a synchronous call to using $timeout as part of this changeset:
e31104f

Changing it back solves my problem, but as I'm unsure why the change was made in the first place, I could be missing something.

@ghost ghost assigned matsko Sep 11, 2013
@jsteenkamp
Copy link

Seeing the same issue without ngAnimate where classes are not preserved on directive element. Same as matsko when switching to stable it works as expected.

@matsko
Copy link
Contributor

matsko commented Sep 20, 2013

I've assigned this to myself and I will be looking at it over the weekend. Most likely it has something to do with the ngClass post digest feature. I'll know for sure when I get to the code.

@matsko
Copy link
Contributor

matsko commented Oct 1, 2013

Sorry I overlooked it at the start and figured it had something to do with the ngInclude issues. This is actually present in another GH issue and there's a commit waiting to be merged in: matsko@e93e8b0

matsko added a commit to matsko/angular.js that referenced this issue Oct 1, 2013
@matsko matsko closed this as completed in 2a63dfa Oct 1, 2013
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.