未捕获错误:[$ injector:modulerr] with angular-ui

时间:2016-05-12 22:24:29

标签: angularjs angular-ui

我的主索引文件在头部有这个:

<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">


  <!-- styles -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css" />

  <!-- scripts -->
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-route.js"></script>
  <script src="script.js"></script>
  <script src="ui-bootstrap-tpls-1.3.2.min.js"></script>
</head>

我的script.js文件包含:

    var testApp = angular.module('testApp', ['ngRoute'], ['ui.bootstrap']);

我得到一个&#34;未捕获的错误:[$ injector:modulerr]&#34;特别与ui.bootstrap有关。如果我删除它作为依赖,我不会得到错误,但我不知道我做错了什么。有什么建议吗?

1 个答案:

答案 0 :(得分:1)

您必须在单个数组中注入依赖项。将其更改为

var testApp = angular.module('testApp', ['ngRoute', 'ui.bootstrap']);