npm 安装 ng-bootstrap 模块
rush:bash;">
npm install @ng-bootstrap/ng-bootstrap --save
在 Angular 项目配置
app.module.ts
rush:js;">
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
imports: [
/**
- ngx-bootstrap
*/
NgbModule.forRoot()
],
添加 bootstrap.min.css 样式
在 assets 文件夹下 bootstrap/bootstrap.min.css , 并在 style.css 文件中添加
rush:js;">
@import "assets/bootstrap/bootstrap.min.css";
测试
app.component.html
rush:xhtml;">
测试结果
示例代码
参考文章
NG Bootstrap - Angular directives specific to Bootstrap 4