加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Angular5 + Bootstrap4使用示例

发布时间:2020-12-17 08:26:48 所属栏目:安全 来源:网络整理
导读:前段时间Bootstrap发布4.0正式版。官网地址:https://getbootstrap.com/ 如何将Angular5与Bootstrap4结合使用呢? 使用Angular-cli初始化项目。 ng new my-project --style=scss 安装Bootstrap及需要的依赖 npm i bootstrap jquery popper.js --save-dev ;

前段时间Bootstrap发布4.0正式版。官网地址:https://getbootstrap.com/

如何将Angular5与Bootstrap4结合使用呢?

使用Angular-cli初始化项目。
ng new my-project --style=scss
安装Bootstrap及需要的依赖 npm i bootstrap jquery popper.js --save-dev;

如果想使用字体图标需要另引入,比如fontawesome
npm i font-awesome --save-dev

在angular-cli.json中引入js文件:

"scripts": [
  "../node_modules/jquery/dist/jquery.js","../node_modules/popper.js/dist/umd/popper.js","../node_modules/bootstrap/dist/js/bootstrap.js"
],

引入样式文件style.scss中:

@import "~bootstrap/scss/bootstrap";
// 定义图标路径
$fa-font-path: "../node_modules/font-awesome/fonts";
@import "../node_modules/font-awesome/scss/font-awesome.scss";

剩下的就是可以自由发挥了

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读