npm 安装 ng-bootstrap 模块
npm install @ng-bootstrap/ng-bootstrap --save
在 Angular 项目配置
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";
测试
app.component.html
添加代码:
test the ng-bootstrap
Left (pre-checked)
Middle
Right
{{model}}
测试结果
示例代码
参考文章
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。