1
我的HTML看起来像这样;ngAnimate什么也不做?
<div class="loadingmsg" ng-show="!isReady()" ng-animate="{show:'animate-show', hide:'animate-hide'}">
<div class="loadingmsg-txt glyphicon glyphicon-flash">{{msg.loading || 'loading'}}</div>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="{{msg.loadingPerc}}" aria-valuemin="0" aria-valuemax="100" style="width: {{msg.loadingPerc}}%;">
{{msg.loadingPerc}}%
</div>
</div>
</div>
而且我已将必要的类添加到CSS;
.animate-show, .animate-hide {
-webkit-transition:all linear 1s;
-moz-transition:all linear 1s;
-ms-transition:all linear 1s;
-o-transition:all linear 1s;
transition:all linear 1s;
}
.animate-show {
opacity:0;
}
.animate-show.animate-show-active {
opacity:1;
}
.animate-hide {
opacity:1;
}
.animate-hide.animate-hide-active {
opacity:0;
}
这一切都很简单。
但随后,无论何时!isReady()
返回true
,我想div
淡出。这并没有发生,绝对没有过渡。
我在做什么错?
编辑 新的CSS:
.loadingmsg.ng-hide-add,
.loadingmsg.ng-hide-remove {
-webkit-transition:all linear 10s;
-moz-transition:all linear 10s;
-ms-transition:all linear 10s;
-o-transition:all linear 10s;
transition:all linear 10s;
}
.loadingmsg.ng-hide-add {
opacity: 0;
}
.loadingmsg.ng-hide-remove {
opacity: 1;
}
和HTML:
<div class="loadingmsg" ng-show="!isReady()">
<div class="loadingmsg-txt glyphicon glyphicon-flash"></div>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="{{msg.loadingPerc}}" aria-valuemin="0" aria-valuemax="100" style="width: {{msg.loadingPerc}}%;">
{{msg.loadingPerc}}%
</div>
</div>
</div>
但是,这仍然没有任何区别。
的哪个版本AngularJS你在用吗?这是最新的吗? (动画使用版本不同) – callmekatootie
@callmekatootie'1.2.6' – Ashesh
您是否包含'angular-animate.js'? - >'' – Vucko