0

I'm trying to make little tests with angular. Everything seems working. But i am having problems with the ngAnimate directive.

i build my animation as simply as possible, here is a plunker with my full code.

http://plnkr.co/edit/Kg7tkpD4pKMz7eKTOIQS

As you can see, the content is not visible. The class "main_animation" is set but not removed (and why is it set ?)

I use the unstable version of angular but there is no issue about on the official repository.

Can someone help me ? Thank you.

4

1 回答 1

1

If you check the source of the rendered HTML, you will see without adding the root div, h1 becomes the root div and is assigned with ng-scope property. And the title was animated correctly in the original version of your code. In the doc about ngAnimate, it is not clearly said the animation will be applied only on the DOM element with ng-scope defined, but I think this is the case.

So if you make the template a single root node including all the stuff, the animation will work.

<div> 
    <h1>Articles</h1>
        <div data-ng-repeat="article in articles">
            <h2>{{article.title}}</h2>
            <div data-ng-bind-html-unsafe="article.content"></div>
        </div>
    <a href="/">Back to home</a>
</div>
于 2013-08-09T19:05:26.570 回答