长知识博客网站,一个编程知识分享网站! Email: 1437393071@qq.com

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

分类: 前端 浏览量: 留言数: 98691

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

添加代码:

<div>
 <span> test the ng-bootstrap</span>
 <div [(ngModel)]="model" ngbRadioGroup name="radioBasic">
  <label >
   <input type="radio" [value]="1"> Left (pre-checked)
  </label>
  <label >
   <input type="radio" value="middle"> Middle
  </label>
  <label >
   <input type="radio" [value]="false"> Right
  </label>
 </div>
 <hr>
 <pre>{{model}}</pre>
</div>

测试结果

示例代码

angular + ng-bootstrap

参考文章

NG Bootstrap - Angular directives specific to Bootstrap 4

Bootstrap 4 components, powered by Angular

ngx-translate core

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

本文地址: http://www.zzsi.net/code/web/98691.html

本站部分资源来源与网络,仅供学习参考使用,请勿商用,如侵犯了您的权益,请联系我们删除。

标签: 上一篇: 下一篇:
在线留言CONTACT US

评论功能已关闭

展开更多