ng动画不触发动画

ng-animate not triggering animations

本文关键字:动画 ng      更新时间:2023-09-26

在我的angular js网站上,我有angular animate lodaed和部署(在检查器中,我在js文件夹中看到angular animatite.js,所以我知道它的加载情况

template.html

<header id="header" ng-animate=" 'animate' ">
 </header>

style.css

.animate-enter {
  -webkit-transition: 1s linear all; /* Chrome */
  transition: 1s linear all;
  opacity: 0;
}
.animate-enter.animate-enter-active {
  opacity: 1;
}

问题是,当我从主页链接点击并加载"template.html"时,没有动画发生。这里缺少什么吗??

根据Angular文档:

自动支持动画的指令有:ngRepeat,ngInclude、ngIf、ngSwitch、ngShow、ngHide、ngView和ngClass。风俗指令可以通过使用$animate来利用动画服务

您需要在头标记中使用其中一个指令。