引导程序指令兼容吗

引导程序指令兼容吗

本文介绍了Bootstrap 3 与当前的 AngularJS 引导程序指令兼容吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

bootstrap 3 版本是否与当前的 AngularJS 引导指令兼容?

我想在 AngularJS 中使用 Bootstrap 2.3.1 指令:

I want to use Bootstrap 2.3.1 directive with AngularJS:

http://angular-ui.github.io/bootstrap/

使用 Bootstrap 3.0.0 CSS:

With the Bootstrap 3.0.0 CSS:

https://github.com/twitter/bootstrap/tree/3.0.0-wip/

为什么?

AngularJS 团队仍在为 v2.3.1 开发 JS 指令,需要时间赶上 v3.0.0.我现在想开始使用 v3 CSS 网格语法.

AngularJS team is still working on JS directives for v2.3.1 and will need time to catch up to v3.0.0. I want to start using v3 CSS grid syntax now.

https://github.com/angular-ui/bootstrap/issues/331>

推荐答案

所以,http://angular-ui.github.io/bootstrap/ 项目依赖于 Bootstrap 的 JavaScript(它没有包装它,不需要等等).这些是从头开始编写的原生 AngularJS 指令,旨在实现轻量级并很好地集成到 AngularJS 生态系统中.

So, the http://angular-ui.github.io/bootstrap/ project does not depend on Bootstrap's JavaScript (it is not wrapping it, not requiring etc.). Those are native AngularJS directives written from the ground-up to be lightweight and well integrated into the AngularJS ecosystem.

Bootstrap 项目唯一遵循的是 Bootstrap 的标记 (HTML) 和 CSS.

如果您问我可以获取所有指令并将它们与 Bootstrap 3.0 一起使用"的问题,答案是视情况而定".这真的取决于 Bootstrap 3.0 是否决定改变它的标记和相应的 CSS 类以及改变多少.我认为某些控件的标记已更改,而其他控件的标记并未更改.

If you ask a question "can I grab all the directives and use them with Bootstrap 3.0" the answer is "it depends". It really depends if and how much Bootstrap 3.0 decide do change its markup and corresponding CSS classes. I would presume that markup of some controls have changed and not for some others.

现在,http://angular-ui.github.io/bootstrap/的好消息 是大部分 HTML 标记和 CSS 类都封装在单独的 AngularJS 模板中.实际上,这意味着您可以获取指令的 JavaScript 代码,只需更改标记(模板)以适应 Bootstrap 3.0.

Now, the very good news with http://angular-ui.github.io/bootstrap/ is that most of the HTML markup and CSS classes are encapsulated in separate AngularJS templates. In practice it means that you can grab the JavaScript code of the directives and only change markup (templates) to fit into Bootstrap 3.0.

所有模板都在这里:https://github.com/angular-ui/bootstrap/tree/master/template通过浏览它们,您应该知道更新标记非常简单,而不会弄乱 JavaScript.这是本项目的设计目标之一.

All the templates are located here:https://github.com/angular-ui/bootstrap/tree/master/templateand by browsing them you should get an idea that it is pretty simple to update markup without messing with JavaScript. This is one of the design goals of this project.

我鼓励你简单地尝试一下,看看 Bootstrap 3.0 的 CSS 如何与现有的指令和模板一起工作.如果您发现任何问题,您可以随时将模板更新到 Bootstrap 3.0(并将它们贡献回项目!)

I would encourage you to simply give it a try and see how CSS of Bootstrap 3.0 works with the existing directives and templates. If you spot any issues you can always update templates to Bootstrap 3.0 (and contribute them back to the project!)

这篇关于Bootstrap 3 与当前的 AngularJS 引导程序指令兼容吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 17:48