AngularJS:淡出一个元素

AngularJS: fading out an element

我正在使用 ng-animate,我已将其设置为依赖项注入。好吧,这是行不通的。

HTML

<p ng-show="atSomeCondition" class="notice">
    Some message.
</p> 

CSS

.notice {
    -webkit-transition: all linear 2s;
    transition: all linear 2s;
    opacity: 1;
}

.notice.ng-hide {
    opacity: 0;
}

有什么建议吗?提前谢谢你。

您使用的 angular/angular-animate 是什么版本?我刚刚在 plunker 中尝试了你的代码,它似乎工作正常:

http://plnkr.co/edit/aMLPgXUMmx5ZNtJfI91W?p=preview

这个 plunker 使用版本 1.4.3。

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.3/angular-animate.min.js"></script>