第一步,安裝。進入項目目錄 npm install ng2-bootstrap bootstrap --save 第二步,angular-cli 配置 ng2-bootstrap src/.angular-cli.json 文件里"apps"項下的"styles"項,添加 bootstrap.min ...
第一步,安裝。進入項目目錄
npm install ng2-bootstrap bootstrap --save
第二步,angular-cli 配置 ng2-bootstrap
src/.angular-cli.json 文件里"apps"項下的"styles"項,添加 bootstrap.min.css
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
]
第三步,測試:
在app.component.html添加使用bootstrap按鈕樣式的代碼:
<!-- Standard button --> <button type="button" class="btn btn-default">(預設樣式)Default</button> <!-- Provides extra visual weight and identifies the primary action in a set of buttons --> <button type="button" class="btn btn-primary">(首選項)Primary</button> <!-- Indicates a successful or positive action --> <button type="button" class="btn btn-success">(成功)Success</button> <!-- Contextual button for informational alert messages --> <button type="button" class="btn btn-info">(一般信息)Info</button> <!-- Indicates caution should be taken with this action --> <button type="button" class="btn btn-warning">(警告)Warning</button> <!-- Indicates a dangerous or potentially negative action --> <button type="button" class="btn btn-danger">(危險)Danger</button> <!-- Deemphasize a button by making it look like a link while maintaining button behavior --> <button type="button" class="btn btn-link">(鏈接)Link</button>
啟動瀏覽器看效果。