twitter-bootstrap - Angular 2 Bootstrap 4 和 ng-bootstrap

标签 twitter-bootstrap angular ng-bootstrap

我对 ng-bootstrap 的需求感到有点困惑如果我们可以直接使用 bootstrap 4 类(使用容器和模态?) .是否有使用其中任何一种的一般规则?

最佳答案

使用 ng-bootstrap 的主要原因之一是 JavaScript 兼容性部分

常规的 Twitter Bootstrap 依赖于 jQuery 进行数据操作。它还通过设置诸如“.active”之类的类或通过将其从现有元素中删除来操纵元素的状态。

另一方面,ng-bootstrap 不需要运行 jQuery。所有元素都是使用不需要 jQuery 的代码从头开始构建的,并且可以与 Angular Core 一起很好地运行。它还通过使用 Bootstrap CSS 文件帮助保留 Bootstrap 组件的外观。

总而言之,如果您使用 Twitter Bootstrap,您就完全依赖 jQuery for JavaScript。当您使用 ng-bootstrap 时,您将完全脱离 jQuery 域,您将完全依赖 AngularJS 来为您提供它的功能部分。 ng-bootstrap 和 Twitter Bootstrap 唯一的共同点是元素的 CSS 样式。

希望这能消除混淆。

关于twitter-bootstrap - Angular 2 Bootstrap 4 和 ng-bootstrap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41922206/

相关文章:

php - 数据库项作为 Bootstrap 4 张卡片

css - Bootstrap 3 网格 3 列

javascript - 无法通过 systemjs 导入 ng-bootstrap

html - Angular/ng-bootstrap - 旋转木马箭头定制

css - 如何创建其标签具有不同字体大小的 Bootstrap 3 导航标签?

html - 如何更改 Bootstrap 导航栏宽度以适应 Column-md-1

angular - 使用angular 2和.Net core webapi下载PDF文件

forms - removeAt() 上的输入中的 Angular 4 表单数组值不正确

angular - Angular 中 async/await 和 async/fixture.whenStable 的区别

Angular2 ng-bootstrap : Reuse modal template with different data