angular2項目添加ng2-bootstrap


1. 先webstome(如果你的開發工具不是webstorm,可以直接在cmd.exe命令行創建)創建一個空的工程。例如test

File--> New -->Project --> Empty Project

2.然后命令行(Alt+F12)下執行以下命令

2.1 進入該工程
C:\Users\kawa2017\WebstormProjects>cd test

2.2、全局安裝angular-cli

npm install -g @angular-cli(目前新的cli為@angular/cli)

* 補充一點:此處可能由於網絡原因下載很慢,或者直接下載失敗,直接添加淘寶鏡像
npm install -g cnpm --registry=https://registry.npm.taobao.org *
2.3、安裝ng2-bootstrap和bootstrap npm install ng2-bootstrap bootstrap --save 2.4、在 .angular-cli.json中配置樣式文件 "styles": [ "styles.css", "../node_modules/bootstrap/dist/css/bootstrap.css" ] 5、 在模板中調用 src/app/app.component.html //此處直接拖bootstrap官方控件,就可以直接使用

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM