app.module中的ui-bootstrap依赖项不起作用

时间:2015-03-22 10:27:15

标签: angularjs twitter-bootstrap

我已经在stackoverflow上查看了这个问题并遵循了所有答案,但仍然无法让ui-bootstrap工作。我已经通过bouwer下载了angular-ui并将其包含在我的index.html中,之后尝试在app模块中注入它,但随后应用程序中断了。

<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="app.js"></script>

和app.js

angular.module("qanda",['ui-bootstrap'])
    .controller('mainCtrl',['$scope','$http',function($scope,$http){
        $scope.testList = [];

Github:https://github.com/khanharis87/quizz_game

3 个答案:

答案 0 :(得分:0)

你应该使用与引导程序一起使用的角度版本,

 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular.js"></script>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.10.0/ui-bootstrap-tpls.min.js"></script>
 <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.css" rel="stylesheet">
 <script src="app.js"></script>

答案 1 :(得分:0)

您正在编写模块名称错误。它应该是'ui.bootstrap'。所以模块应该是这样的:

angular.module('qanda', ['ui.bootstrap'])

确保包含bootstrap css文件,但不包括js文件。使用angular-ui指令。

答案 2 :(得分:0)

以防万一,当您从凉亭安装bootstrap-ui时,请务必在主文件夹中使用--save

  

bower安装angular-bootstrap --save

如果您使用bower的“--save”,则不需要在标题中或身体末尾添加css或脚本标签.bower会自动(并且正确地)为您执行此操作。< / p>