2016-03-07 54 views
1

我用角种子,我加引导到项目角种子工程 - 角架JS依赖

index.html中我使用这个脚本。

<script src="bower_components/jquery/dist/jquery.js"></script> 
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script> 
<script src="bower_components/angular/angular.js"></script> 
<script src="bower_components/angular-ui-router/release/angular-ui-router.min.js"></script> 
<script src="app.js"></script> 

当我运行NPM邵逸夫更新索引异步

这就是产生这个脚本部分

$script([ 
     'bower_components/jquery/dist/jquery.js', 
     'bower_components/bootstrap/dist/js/bootstrap.js', 
     'bower_components/angular/angular.js', 
     'bower_components/angular-ui-router/release/angular-ui-router.min.js', 
     'app.js' 
    ] 

,但是当我加载索引异步,我得到“未捕获的错误:引导的JavaScript需要jQuery“。

如何使用angular-loader.js管理依赖项。有没有机会如何做到这一点?

回答

2

为了回答你的问题,一般我们应该避免使用JQueryBootstrap库用途时,你可以在顺序的AngularJS应用程序,以获得开箱即用的功能。相反,您可以使用angular ui-bootstrap而不是Bootstrap
无论使用JQuery提供的功能如何,都可以通过使用AngularJS开发出更加优雅的方式。
此外,Angular有一个内置的JQuery库叫jqLite

在github中有一系列角种子项目。但每个人都不同,并解决特定领域。不是大多数种子项目都包含一般项目所需的大部分实施。

对于jqlite参照这些官方的文档链接 -

因此,我已经产生了一个,我更常用来生成我angularjs项目。希望能够帮助您了解并学习项目模式和示例实现。
AngularJS Seed Project

0

可能是因为在角度中使用的jquery lite之间存在冲突。使用角材料并且仅引用bootstrap.css或检查角靴。最好不要在JQuery中使用Angular。

Material ui-bootstrap

+0

你能给我一些链接吗? –