如何整合引导-3.0.1和AngularJS? [英] How to integrate bootstrap-3.0.1 and AngularJS?
问题描述
我应该同时使用AngularJS和Bootstrap项目( http://getbootstrap.com/ )取警报和流程指示标志。
I have a project which should use both AngularJS and Bootstrap(http://getbootstrap.com/) to take Alert and Process Indicator there.
但是,当我有引导的CSS文件它混合应用的话,其它的CSS文件的definings似乎被覆盖。
But when I include Bootstrap's css file it mixes Application so, that other css file's definings seems to be overridden.
如何这两个框架应该在同一个应用程序中使用?
How these two Frameworks should be used in same Application?
我已经试过几乎所有的东西我知道,但都没有成功这两个在同一应用程序相结合。
I have tried almost everything I know but haven't succeeded to combine these two in the same application.
最好的问候,
推荐答案
DONT。引导是基于一个jQuery供电的心态,这是因为DOM操作的孤立状态机根本组件化。角是基于围绕角$消化,HTML编辑一种完全不同的思维过程。
DONT. Bootstrap is based on a jQuery powered mentality, that is fundamentally componentized as isolated state machines of DOM manipulation. Angular is based on a radically different thought process based around Angular $digestion, and HTML compilation.
如果你必须将它们结合起来,做到CSS ONLY。具有两组状态机的一个适配器引入的开销和余地不需要存在人为的错误。我建议编写采取白手起家CSS的优势,自己的角度指令,但并不想在JS水平二合一应用程序集成。
If you must combine them, do CSS ONLY. Having two sets of state machines with an adapter introduces overhead and room for human error that does not need to exist. I recommend writing your own angular directives that take advantage of Bootstraps CSS, but NOT trying to integrate the two in one application on the JS level.
现在已经有几个项目在那里尝试通过指令来做到这一点,这是一个好主意。我建议使用不依赖于jQuery和是土生土长的角度实现,而不是适应引导的jQuery的code到角一个引导指令项目进展。
There are already a few projects out there trying to do this via directives, which is a good idea. I recommend going with a bootstrap directive project that does not depend on jQuery and is a native Angular implementation, rather than adapting Bootstrap's jQuery code into Angular.
- 没有这一项:<一href=\"https://github.com/mgcrea/angular-strap/blob/master/src/directives/button.js\">https://github.com/mgcrea/angular-strap/blob/master/src/directives/button.js
- 但是这一个: http://angular-ui.github.io/bootstrap/
- 或写信给你
自己!
更新现在有引导的纯角版本。在此查找 - > http://mgcrea.github.io/angular-strap/
UPDATE There is now a pure angular version of bootstrap. Find it here -> http://mgcrea.github.io/angular-strap/
这篇关于如何整合引导-3.0.1和AngularJS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!