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

ng-animate does not work in conjunction with ng-view when root element of view is a directive #2322

Closed
cburgdorf opened this issue Apr 7, 2013 · 3 comments

Comments

@cburgdorf
Copy link
Contributor

Here is a working example that uses ng-view and where the injected views start with a custom directive:

http://jsfiddle.net/cburgdorf/dLbga/

Now add ng-animate to it and see how it fails:

http://jsfiddle.net/cburgdorf/7W3KQ/

We can use a workaround to show that the animate would actually work. All we need to do is to wrap the directive in yet another div. So it seems it has something to do with the root element of the view being a custom directive.

http://jsfiddle.net/cburgdorf/nFhX8/

Another thing to note here is that the setup class is never removed in this case. The way I understand it all animation classes should automatically be removed at the end.

@cburgdorf
Copy link
Contributor Author

Thinking a bit more about the problem I wonder if this has something to do with the directive using replace: true. It seems to be fixable by configuring the directive to not replace but append instead.

I created a updated fiddle that now works but uses replace: false instead:

http://jsfiddle.net/cburgdorf/YE6TT/

However, even if I switch to replace: false it doesn't work until I switch the directive from element to attribute syntax (That has nothing to do with angular. It's more that elements are by default rendered as inline elements so one needs to add a css rule to set it to display:block):

So at the moment it seem the issue boils down to not working together with replace: true. I wonder if there is something that can be done about that?

@cburgdorf
Copy link
Contributor Author

I guess what should happen is that the view should be compiled first and then the animation classes should be added to the top level element of the view. Because then it's safe to add them since the elements are already final.

However, I have too less insight in how things work and if it really can be done that way.

@btford
Copy link
Contributor

btford commented Aug 24, 2013

As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months.

Please try the newest versions of Angular (1.0.8 and 1.2.0-rc.1), and if the issue persists, comment below so we can discuss it.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants