Javascript Angular.js动画不工作
我用HTML编写了一个小代码Javascript Angular.js动画不工作,javascript,angularjs,Javascript,Angularjs,我用HTML编写了一个小代码 <html ng-app="myApp"> <head> <script src='https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js' ></script> <script src='//ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular-an
<html ng-app="myApp">
<head>
<script src='https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js' ></script>
<script src='//ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular-animate.js' /></script>
<script src='./hello.js' ></script>
<style>
.sample-show-hide {
padding:10px;
border:1px solid black;
background:white;
}
.sample-show-hide {
-webkit-transition:all linear 3s;
transition:all linear 3s;
}
.sample-show-hide.ng-hide {
opacity:0;
}
</style>
</head>
<body ng-controller='Sample'>
<div class='sample-show-hide' style='z-index:2;' ng-init='timeout=false;' ng-hide='timeout'> Unable to get location </div>
</body>
</html>
但在我的代码中,动画不起作用。有人能告诉我为什么它不起作用吗
var myApp = angular.module('myApp',["ngAnimate"]);
尝试以下代码:)您需要包括
angular animate.js
并将其添加到您的模块中,就像下面的angular.module('myApp',['ngAnimate'])代码>,它会工作的很好。感谢它现在工作。12分钟后,当我接受答案时,将接受stackoverflow发出的警告。
var myApp = angular.module('myApp',["ngAnimate"]);