angular - 有问题将 bootstrap4-toggle 导入 Angular 8
问题描述
我是 Angular 的新手,我正在尝试从以下来源导入 bootstrap4-toggle: https ://gitbrent.github.io/bootstrap4-toggle/#api 到我的项目中,以添加一个切换复选框:) 我运行 npm安装并且我在packjage.json中找到了项目中的包,现在我需要将它添加到“样式”但我不知道要添加什么,我试过了
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/bootstrap4-toggle/css/bootstrap4-toggle.min.css",
"src/styles.css",
"node_modules/font-awesome/css/font-awesome.css"
],
但它没有用......我在导航栏中使用了这个标签
<input type="checkbox" checked data-toggle="toggle">
它应该看起来像一个切换按钮,而不是看起来像一个普通的 html 复选框。
解决方案
在 angular.json 中的脚本和样式中添加导入
"styles": [
"src/styles.css",
"node_modules/bootstrap4-toggle/css/bootstrap4-toggle.min.css"
],
"scripts": [
"node_modules/bootstrap4-toggle/js/bootstrap4-toggle.min.js"
]
推荐阅读
- python-3.x - 有没有办法将 mysql-connector-python 中的“pool_reset_connection”与 MariaDB 10.4.7 一起使用?
- android - 接口 MultiplePermissionsListener 没有构造函数
- sublimetext3 - 如何使用 sublime 3 session 文件恢复文件夹和文件?操作系统
- javascript - CodeMirror:onChanges - 如何检测更改是什么?
- javascript - 如何在 JavaScript 中设置音频文件的音量
- php - 从 .htaccess 配置中删除结尾的斜杠
- python - python selenium不加载firefox扩展
- kubernetes - How to login to Kubernetes using service account?
- r - 犰狳中的合并功能
- r - 由于 0 方差而具有 NA 值的 cor 函数