詳解在Angular項(xiàng)目中添加插件ng-bootstrap
npm 安裝 ng-bootstrap 模塊
npm install @ng-bootstrap/ng-bootstrap --save
在 Angular 項(xiàng)目配置
app.module.ts
添加
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
imports: [
/**
* ngx-bootstrap
*/
NgbModule.forRoot()
],
添加 bootstrap.min.css 樣式
在 assets 文件夾下 bootstrap/bootstrap.min.css , 并在 style.css 文件中添加
@import "assets/bootstrap/bootstrap.min.css";
測(cè)試
app.component.html
添加代碼:
<div>
<span> test the ng-bootstrap</span>
<div [(ngModel)]="model" ngbRadioGroup name="radioBasic">
<label class="btn btn-primary">
<input type="radio" [value]="1"> Left (pre-checked)
</label>
<label class="btn btn-primary">
<input type="radio" value="middle"> Middle
</label>
<label class="btn btn-primary">
<input type="radio" [value]="false"> Right
</label>
</div>
<hr>
<pre>{{model}}</pre>
</div>
測(cè)試結(jié)果

示例代碼
參考文章
NG Bootstrap - Angular directives specific to Bootstrap 4
Bootstrap 4 components, powered by Angular
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- Angular實(shí)現(xiàn)的進(jìn)度條功能示例
- AngularJS實(shí)現(xiàn)進(jìn)度條功能示例
- Spring Boot+AngularJS+BootStrap實(shí)現(xiàn)進(jìn)度條示例代碼
- 如何在Angular2中使用jQuery及其插件的方法
- AngularJS中如何使用echart插件示例詳解
- Angular4項(xiàng)目中添加i18n國(guó)際化插件ngx-translate的步驟詳解
- 如何在AngularJs中調(diào)用第三方插件庫(kù)
- Angular5中調(diào)用第三方j(luò)s插件的方法
- Angular2整合其他插件的方法
- angular4+百分比進(jìn)度顯示插件用法示例
相關(guān)文章
Angular中$broadcast和$emit的使用方法詳解
本篇文章主要介紹了Angular中$broadcast和$emit的使用方法詳解,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-05-05
Angular服務(wù)Request異步請(qǐng)求的實(shí)例講解
今天小編就為大家分享一篇Angular服務(wù)Request異步請(qǐng)求的實(shí)例講解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-08-08
Angular將填入表單的數(shù)據(jù)渲染到表格的方法
這篇文章主要介紹了Angular將填入表單的數(shù)據(jù)渲染到表格的方法,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2017-09-09
Angularjs中$http以post請(qǐng)求通過(guò)消息體傳遞參數(shù)的實(shí)現(xiàn)方法
這篇文章主要介紹了Angularjs中$http以post請(qǐng)求通過(guò)消息體傳遞參數(shù)的方法,結(jié)合實(shí)例形式分析了$http使用post請(qǐng)求傳遞參數(shù)的相關(guān)設(shè)置與使用技巧,需要的朋友可以參考下2016-08-08
AngularJS中取消對(duì)HTML片段轉(zhuǎn)義的方法例子
這篇文章主要介紹了AngularJS中取消對(duì)HTML片段轉(zhuǎn)義的方法例子,在一些需要顯示HTML的地方,就要取消AngularJS的轉(zhuǎn)義,本文就介紹了這種方法,需要的朋友可以參考下2015-01-01

