Angular入门(三) 引入boostrap4

本文介绍如何在Angular项目中集成Bootstrap框架。主要包括使用cnpm安装Bootstrap和必要的依赖项jQuery,配置angular-cli.json文件来引入Bootstrap的样式和脚本,以及在style.css中导入Bootstrap样式。

1.cnpm install ngx-bootstrap bootstrap --save

   ※可能缺少jquery  cnpm i jquery

2.  打开 angular-cli.json (项目根目录下)

      style 节点 增加

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

     script: 节点增加:

  "scripts": [
    "../node_modules/jquery/dist/jquery.min.js",
    "../node_modules/bootstrap/dist/js/bootstrap.bundle.js"
  ],

如果 引入"../node_modules/bootstrap/dist/js/bootstrap.min.js" 会缺少 popper,js.(bootstrap4 里面集成了popper,也可以cnpm  安装)

3.打开 style.css (项目根目录下)

  增加:@import '~bootstrap/dist/css/bootstrap.min.css';

 

转载于:https://www.cnblogs.com/zhuzy/p/8031718.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值