且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何整合引导-3.0.1和AngularJS?

更新时间:2022-11-10 23:11:25

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.

更新现在有引导的纯角版本。在此查找 - > 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/