Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/395.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 为什么不是';t角引导被注射?_Javascript_Angularjs_Twitter Bootstrap_Bower - Fatal编程技术网

Javascript 为什么不是';t角引导被注射?

Javascript 为什么不是';t角引导被注射?,javascript,angularjs,twitter-bootstrap,bower,Javascript,Angularjs,Twitter Bootstrap,Bower,如何将角度引导正确地注入angularjs应用程序? 当我在index.html中手动包含带有以下代码的库的远程版本时,angular bootstrap可以工作: <!-- start manual dependencies for testing purposes --> <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular.js" data-semver="1.5.0" d

如何将角度引导正确地注入angularjs应用程序?

当我在
index.html
中手动包含带有以下代码的库的远程版本时,angular bootstrap可以工作

<!-- start manual dependencies for testing purposes -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular.js" data-semver="1.5.0" data-require="angularjs@1.5.0"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular-animate.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular-route.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular-touch.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular-cookies.js"></script>
<link data-require="ui-bootstrap@0.13.1" data-semver="0.13.1" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css" />
<script data-require="ui-bootstrap@0.13.1" data-semver="0.13.1" src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.13.1/ui-bootstrap-tpls.js"></script>
<!-- end manual dependencies for testing purposes -->
Bower然后在
index.html
中生成以下包含列表,以取代上面显示的手册包含:

<!-- build:js(.) scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="bower_components/angular-aria/angular-aria.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-messages/angular-messages.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/angular-touch/angular-touch.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<!-- endbower -->
<!-- endbuild -->
由于应用程序在使用http includes at top时正确编译和运行JavaScript,因此您确实不需要知道我是如何将
ui.bootstrap
注入应用程序模块的,但为了彻底起见,我将包括以下内容:

angular
  .module('app', ['ngAnimate', 'ngRoute', 'ngTouch', 
      'auth', 'home', 'secure', 'public1', 'navigation',
      'ui.bootstrap' ])

为了从本地bower文件夹成功地将angular bootstrap注入应用程序,需要对上述内容进行哪些具体更改?

我不知道您正在使用什么来自动化文件路径,但它缺少
angular bootstrap
主js文件。您将需要模板(您已经包括了这些模板),如下所示:



是否所有文件都按与以前相同的顺序列出,包括与应用程序代码相关的文件?另外,你的浏览器能找到你的bower目录吗?@tyler浏览器当然能找到bower目录,因为angular应用程序在我尝试添加angular引导程序之前一直与自动构建一起工作。订单完全如OP所示。是否有任何附加文件需要我发布?@estus此应用程序不使用wiredep。安装程序包括node.js、yeoman、Grunt和bower。谢谢。我想在不禁用Bower将依赖项自动生成为
index.html
的情况下测试这一点
bower.json
似乎是定义生成内容的文件。我把它贴在上面了。为了生成您建议的包含,我应该向
bower.json
添加什么?这是不是应该在
bower.json
中手动设置,或者在
bower安装…
命令中,或者在其他类似
GruntFile.js
的地方手动设置?应该在您的GruntFile中-这不是bower问题。Grunt是一个构建工具,所以它很可能是移动东西的工具。(旁注:我个人建议使用gulp)尝试搜索各种配置文件,查找
ui bootstrap tpls.js
,无论您在哪里看到,这都是需要将
ui bootstrap.js
文件添加到构建过程中的一个很好的候选文件。
{
  "name": "client",
  "version": "0.0.0",
  "dependencies": {
    "angular": "^1.4.0",
    "bootstrap-sass-official": "^3.2.0",
    "angular-animate": "^1.4.0",
    "angular-aria": "^1.4.0",
    "angular-cookies": "^1.4.0",
    "angular-messages": "^1.4.0",
    "angular-resource": "^1.4.0",
    "angular-route": "^1.4.0",
    "angular-sanitize": "^1.4.0",
    "angular-touch": "^1.4.0",
    "angular-bootstrap": "^1.2.5"
  },
  "devDependencies": {
    "angular-mocks": "^1.4.0"
  },
  "appPath": "app",
  "moduleName": "clientApp",
  "overrides": {
    "bootstrap": {
      "main": [
        "less/bootstrap.less",
        "dist/css/bootstrap.css",
        "dist/js/bootstrap.js"
      ]
    }
  }
}
angular
  .module('app', ['ngAnimate', 'ngRoute', 'ngTouch', 
      'auth', 'home', 'secure', 'public1', 'navigation',
      'ui.bootstrap' ])
<script src="bower_components/angular-bootstrap/ui-bootstrap.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>