0

我不知道为什么 angular-velocity 模块没有初始化,尽管我包含了这里写的所有必需的脚本(https://github.com/cgwyllie/angular-velocity

这是我的 HTML index.html

<!DOCTYPE html>
<html lang="en" ng-app="myapp">

<head>
    <meta charset="utf-8">
    <title>MyApp</title>
</head>

<body>
    <script src="lib/jquery/jquery.min.js"></script>
    <script src="lib/jquery/jquery-ui.min.js"></script>
    <script src="lib/angular.js/angular.min.js"></script>
    <script src="lib/velocity/jquery.velocity.min.js"></script>
    <script src="lib/velocity/velocity.ui.min.js"></script>
    <script src="lib/velocity/angular-velocity.min.js"></script>
    <script src="app.js"></script>
</body>

</html>

这是我的应用程序,js

var app = angular.module('myapp', ['angular-velocity']);

通过运行它,我在 chrome 控制台中收到以下错误。

Failed to instantiate module myapp due to:
Error: [$injector:modulerr] .....

有人可以向我解释为什么这个模块无法初始化吗?

4

2 回答 2

4

角速度取决于 ngAnimate 模块(参见https://github.com/cgwyllie/angular-velocity/blob/master/angular-velocity.js#L6),不幸的是项目页面上没有提到它。

在您的页面中下载并添加对 angular-animate.js ( https://github.com/angular/angular.js/tree/master/src/ngAnimate ) 的引用,即:

<script src="lib/angualar.js/angular-animate.js"></script>

或使用凉亭呼叫时

bower install angular-animate

并添加

<script src="/bower_components/angular-animate/angular-animate.js"></script>

到您的页面。

于 2014-08-24T15:04:09.530 回答
0

也许考虑切换到 Velocity 的官方非官方角度插件:https ://github.com/rosslavery/velocity-ui-angular

于 2014-09-15T17:24:06.887 回答