Angular 应用程序中的 Bootstrap 5 [英] Bootstrap 5 in Angular Application

查看:28
本文介绍了Angular 应用程序中的 Bootstrap 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自版本 5 Bootstrap 框架已将 jQuery 作为一项要求删除.

Since version 5 Bootstrap framework has removed jQuery as a requirement.

我想知道此更改如何影响 Angular 应用程序?

我们可以在 Angular 中使用所有提供的 Bootstrap 功能吗(例如下拉菜单)?

Can we use all provided Bootstrap functionalities in Angular (for example dropdowns)?

我知道 Angular 不应该与 JQuery 结合使用 - 在 Bootstrap 的早期版本中,如果我们想使用所有引导程序功能,建议导入 JQuery,但它很糟糕.

I know that Angular shouldn't be combined with JQuery - in earlier versions of Bootstrap, JQuery was recommened to import if we want to use all bootstrap functionalities and it was bad.

但是 Bootstrap 5 不再依赖于 JQuery,所以在我的 Angular 应用程序中使用它是否安全?

But Bootstrap 5 doesn't rely on JQuery anymore so is it safe to use it with my Angular applications?

至于现在我不想使用像 ng-bootstrap 这样的引导程序替代品,这就是为什么我要问在 Angular 中使用 Bootstrap 5 是否可以和安全?

As for now I don't want to use bootstrap alternatives like ng-bootstrap, that is why I'm asking is it okay and safe to use Bootstrap 5 in Angular?

推荐答案

是的,您现在可以使用它.您可以通过 npm 安装以及在项目中包含 CDN 链接来使用它.

Yes, you can use it now. You can use it by installing with npm as well as by including the CDN links in your project.

<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">

<!-- JavaScript Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous"></script>

您还可以在此处检查 angular 11 中引导程序 5 的实现.- https://www.c-sharpcorner.com/article/add-bootstrap-5-in-angular-11/

You can also check the implementation of the bootstrap 5 in angular 11 here. - https://www.c-sharpcorner.com/article/add-bootstrap-5-in-angular-11/

这篇关于Angular 应用程序中的 Bootstrap 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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