详解在Angular项目中添加插件ng-bootstrap

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;">
test the ng-bootstrap
dioGroup name="radioBasic">
{{model}}

测试结果

示例代码

angular + ng-bootstrap

参考文章

NG Bootstrap - Angular directives specific to Bootstrap 4

Bootstrap 4 components,powered by Angular

ngx-translate core

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程之家。

相关文章

Bootstrip HTML 查询搜索常用格式模版 <form class=&...
如何在按钮上加红色数字 您可以使用Bootstrap的badge组件来在...
要让两个按钮左右排列,你可以使用 Bootstrap 的网格系统将它...
是的,可以将status设置为布尔类型,这样可以在前端使用复选...
前端工程师一般用的是Bootstrap的框架而不是样式,样式一般自...
起步导入:<linkrel="stylesheet"href="b...