2016-03-07 56 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

你能給我一些鏈接嗎? –