无法在样板angularjs app中加载angular-bootstrap模块

时间:2014-09-05 02:35:25

标签: javascript angularjs angular-ui-bootstrap

我开始使用AngularJS项目,从angular-seed开始,感受它。

我正在尝试加载angular-bootstrap,但是当我在app.js文件依赖项中添加模块时:

angular.module('myApp', [
  'ngRoute',
  'ui.utils',
  'ui.bootstrap', //<------
  'myApp.filters',
  'myApp.services',
  'myApp.directives',
  'myApp.controllers'
]) 

运行我的应用时出现以下错误:

[$injector:nomod] Module 'ui.bootstrap' is not available! 
You either misspelled the module name or forgot to load it. 
If registering a module ensure that you specify the dependencies as the second argument.

我安装了angular-bootstrap,文件位于我的app/bower-components目录中:

├── angular-bootstrap
│   ├── bower.json
│   ├── ui-bootstrap.js
│   ├── ui-bootstrap.min.js
│   ├── ui-bootstrap-tpls.js
│   └── ui-bootstrap-tpls.min.js

根据安装说明中的设置,我在index.html文件中引用了bootstrap.css和angular.js.

我知道还有另一个问题在Error: [$injector:nomod] Module 'ui.bootstrap' is not available! while Karma run in webstorm中询问了同样的错误,但这是用于运行Karma测试,我甚至无法在运行应用程序时加载模块。

2 个答案:

答案 0 :(得分:1)

请务必包含指向js文件的链接

<link rel="stylesheet" href="bower_components/html5-boilerplate/css/ui-bootstrap.css">

答案 1 :(得分:0)

您还应该将bootstrap(bower install bootstrap)添加到我们的应用程序并包含

我们的应用程序中的bootstrap / dist / js / bootstrap.min.js

相关问题