如何添加bootstrap到Angular工程
来源:互联网 发布:js null 编辑:程序博客网 时间:2024/05/23 13:24
执行
ng new
命令新建一个工程
然后执行下面命令安装bootstrap所需要的组件
npm install --save ng-bootstrap/ng-bootstrapnpm install --save bootstrap@v4.0.0-beta.2npm install --save font-awesome
打开.angular-cli.json文件,添加bootstrap CSS
"styles": [ "styles.css", "../node_modules/font-awesome/css/font-awesome.css", "../node_modules/bootstrap/dist/css/bootstrap.min.css" ],
打开app.module.ts文件,初始化ng-bootstap
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';@NgModule({ declarations: [AppComponent, ...], imports: [NgbModule.forRoot(), ...], bootstrap: [AppComponent]})export class AppModule {}
打开app.component.html,并输入下面这此测试内容
<div class="jumbotron"> <div class="container"> <ngb-alert type="success" [dismissible]="false"> Bootstrap is working! </ngb-alert> <h1> <i class="fa fa-bath" aria-hidden="true"></i> And so is Font Awesome! </h1> </div></div><div class="container"> <p> A progress bar: <ngb-progressbar showValue="true" type="success" [value]="65"> </ngb-progressbar> </p></div><div class="container"> <ngb-tabset> <ngb-tab title="Bacon"> <ng-template ngbTabContent> <p class="mt-4">Content for tab 1. <button type="button" class="btn btn-secondary" placement="bottom" ngbPopover="A popover in tab 1" popoverTitle="Bacon is good"> Click me </button> </p> </ng-template> </ngb-tab> <ngb-tab title="Lettuce"> <ng-template ngbTabContent> <p>Content for tab 2</p> </ng-template> </ngb-tab> <ngb-tab title="Tomatoes"> <ng-template ngbTabContent> <p>Content for tab 3</p> </ng-template> </ngb-tab> </ngb-tabset></div>
执行
ng server
命令并用浏览器测试
阅读全文
0 0
- 如何添加bootstrap到Angular工程
- Angular CLI --添加bootstrap
- 【Angular】Angular项目添加ng-bootstrap插件
- ios 如何添加字体到工程中
- 如何将已有的资源添加到如今工程中
- 如何将已有的资源添加到如今工程中
- STM32如何添加需要的库到工程
- 如何手动添加BCG界面库到工程中
- angular-bootstrap
- angular.bootstrap
- angular + bootstrap
- 添加类到工程
- libxml 添加到工程
- 在 Angular 项目中添加插件 ng-bootstrap
- 如何添加doubango工程
- 工程如何添加Alamofire
- angular 回车事件添加数据到li
- 如何将一个工程中的对话框资源添加到另一工程中
- Description Resource Path Location Type Project configuration is not up-to-d
- Spring(SpringMVC)工作机制?
- 实现一个go语言的简单爬虫来爬取CSDN博文(一)
- HTTP必知必会
- 使用xshell上传下载文件
- 如何添加bootstrap到Angular工程
- TR中ABP线OP20增加防错提示
- Spring框架之IoC容器—概览
- Angular增加国际化支持
- 网易云音乐 ubuntu 版左上角的图标 处理
- 10-23-C++面试综合题
- Eclipse的使用
- nodejs+ejs模板进行单列测试
- 远程监控服务是否开启