源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

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

  • 时间:2022-07-14 05:14 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:详解在Angular项目中添加插件ng-bootstrap
npm 安装 ng-bootstrap 模块
npm install @ng-bootstrap/ng-bootstrap --save
在 Angular 项目配置 [b]app.module.ts[/b] 添加
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";

 imports: [
  /**
   * ngx-bootstrap
   */
  NgbModule.forRoot()
 ],
[b]添加 bootstrap.min.css 样式[/b] 在 assets 文件夹下 bootstrap/bootstrap.min.css , 并在 style.css 文件中添加
@import "assets/bootstrap/bootstrap.min.css";
[b]测试[/b] [b]app.component.html[/b] 添加代码:
<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>
测试结果 [img]http://files.jb51.net/file_images/article/201707/20177492347132.png?20176492359[/img] [b]示例代码[/b] [url=https://github.com/1CSH1/james-blog-ui/tree/6c2c1503b4102c28b14f8b9e7fb447f8d52e1548]angular + ng-bootstrap[/url] [b]参考文章[/b] [url=https://github.com/ng-bootstrap/ng-bootstrap]NG Bootstrap - Angular directives specific to Bootstrap 4[/url] [url=https://ng-bootstrap.github.io/#/home]Bootstrap 4 components, powered by Angular[/url] [url=https://github.com/ngx-translate/core]ngx-translate core[/url] 以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程素材网。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部