【问题标题】:angular-velocity Uncaught Error: [$injector:modulerr]角速度未捕获错误:[$injector:modulerr]
【发布时间】:2014-09-16 01:24:06
【问题描述】:

我不知道为什么 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] .....

谁能解释一下为什么这个模块不能初始化?

【问题讨论】:

  • 检查所有脚本文件是否正确加载。

标签: node.js angularjs velocity.js


【解决方案1】:

角速度取决于 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 调用时

bower install angular-animate

并添加

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

到您的页面。

【讨论】:

  • 如果您提供更多源示例或将链接添加到您将获得此信息的资源上,那就太好了
【解决方案2】:

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

【讨论】:

  • 我回顾了他们两个,角速度有更多的特点。
猜你喜欢
  • 2016-07-23
  • 2015-03-29
  • 1970-01-01
  • 1970-01-01
  • 2016-11-16
  • 2017-06-14
  • 2014-09-28
  • 2016-10-21
相关资源
最近更新 更多