Angular 4:如何包含 Bootstrap? [英] Angular 4: How to include Bootstrap?

查看:17
本文介绍了Angular 4:如何包含 Bootstrap?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名后端开发人员,我只是在玩 Angular4.所以我做了这个安装教程:https://www.youtube.com/watch?v=cdlbFEsAGXo.

I'm a backend developer and I'm just playing around with Angular4. So I did this installation tutorial: https://www.youtube.com/watch?v=cdlbFEsAGXo.

鉴于此,我如何向应用程序添加引导程序,以便我可以使用container-fluid"或col-md-6"类之类的东西?

Given this, how can I add bootstrap to the app so I could use the class "container-fluid" or "col-md-6" and stuff like that?

推荐答案

npm install --save bootstrap

之后,在 angular-cli.json(在项目的根文件夹内)中,找到 styles 并像这样添加 bootstrap css 文件:

afterwards, inside angular-cli.json (inside the project's root folder), find styles and add the bootstrap css file like this:

"styles": [
   "../node_modules/bootstrap/dist/css/bootstrap.min.css",
   "styles.css"
],

更新:
在 angular 6+ angular-cli.json 已更改angular.json.

这篇关于Angular 4:如何包含 Bootstrap?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆