簡體   English   中英

Angular-ui-router自動刪除

[英]Angular-ui-router is deleted automatically

因此,我使用yeoman做一個基礎項目。 安裝后,我想使用Angular-ui-router,所以我會bower install ui-router 我在index.html中注入了<script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script> ,並按照許多教程中的說明進行了所有操作。 但是問題出在我做grunt serve ,被注入index.html的<script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script>自動刪除。 我需要那個組件。 你們能幫我解決這個問題嗎?

約曼角發生器使用wiredep自動注入涼亭組件。 因此,首先您不應該手動添加它們,它們會被grunt刪除,並用作有線清理該塊並注入已注冊的Bower組件

因此,每個Bower組件都應位於bower.json文件上,但我假設您缺少ui-router ,可以將其手動添加到bower.json中,也可以在bower命令上添加--save以將其自動保存到bower.json中。

bower install ui-router --save

運行此文件以將其保存在bower.json上,然后運行

grunt serve

它會工作...

在安裝Bower組件時添加--save或--save-dev,這會將已安裝的組件添加到bower.json中。

bower install ui-router --save

通過--save安裝Bower組件后,grunt serve會將所有Bower.json文件從Bower.json添加到index.html文件。 因此,您無需手動將Bower組件添加到index.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM