gpt4 book ai didi

javascript - Angular 应用程序中的 Bootstrap 5

转载 作者:行者123 更新时间:2023-12-04 12:32:20 25 4
gpt4 key购买 nike

从版本 5 Bootstrap 框架已删除 jQuery 作为要求。
我想知道此更改如何影响 Angular 应用程序?
我们可以在 Angular 中使用所有提供的 Bootstrap 功能(例如下拉菜单)吗?
我知道 Angular 不应该与 JQuery 结合使用——在早期版本的 Bootstrap 中,如果我们想使用所有 Bootstrap 功能,建议导入 JQuery,这很糟糕。
但是 Bootstrap 5 不再依赖 JQuery,所以在我的 Angular 应用程序中使用它是否安全?
至于现在我不想使用像 ng-bootstrap 这样的 Bootstrap 替代品,这就是为什么我问它可以吗?保险箱在 Angular 中使用 Bootstrap 5?

最佳答案

安装 Bootstrap 只需使用

npm install bootstrap
并编辑 angular.json 文件
        "styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css", //<--add this line
"src/styles.css"
],
"scripts": [
"node_modules/bootstrap/dist/js/bootstrap.bundle.min.js" //<--and this line
]

关于javascript - Angular 应用程序中的 Bootstrap 5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68081166/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com