Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Angular.js动画不工作_Javascript_Angularjs - Fatal编程技术网

Javascript Angular.js动画不工作

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编写了一个小代码

<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"]);