做一件使用Twitter的引导与Angular.js时需要jQuery的?时需、Angular、Twitter、jQuery

2023-09-13 03:00:28 作者:超喜欢你

是jQLite(与AngularJS建)足以Twitter的引导执行JavaScript的功能(比如下拉菜单)?

docs.angularjs 说:

  

从DOM操纵停止试图使用jQuery来修改DOM中  控制器。真。这包括添加元素,删除元素,  检索的内容,显示和隐藏它们。使用内置  指令,或写自己在必要时,做你的DOM  操纵。可以看看下面的复制功能。

解决方案 干货 方法用对Twitter也能打造爆款 不信,看国外大卖怎么做推广的

按照角UI Github上,没有。

 本地AngularJS(角)指令对Twitter的引导。占地面积小(5kB的gzip压缩!),没有第三方JS依赖(jQuery的,JS引导)需要!http://angular-ui.github.io/bootstrap/ 

虽然牢记,这是专门为角UI做了一个包装,你可以/不可以能够轻松地使用他人已经使用此书面引导插件。

不过与默认角度UI&安培;引导副本那么你需要的jQuery在GitHub的库中的code已被大量修改,而不jQuery的工作。

正如评论指出 UI引导是一个非常好的选择,以及

Is the jQLite (in built with AngularJS) sufficient to execute javascript functionality (like dropdowns) in Twitter Bootstrap?

docs.angularjs says:

DOM Manipulation from Stop trying to use jQuery to modify the DOM in controllers. Really. That includes adding elements, removing elements, retrieving their contents, showing and hiding them. Use built-in directives, or write your own where necessary, to do your DOM manipulation. See below about duplicating functionality.

解决方案

According to the Angular UI Github, no.

Native AngularJS (Angular) directives for Twitter's Bootstrap. Small footprint (5kB gzipped!), no 3rd party JS dependencies (jQuery, bootstrap JS) required! 
http://angular-ui.github.io/bootstrap/

Though bear in mind this is a wrapper made specifically for Angular UI, you may/may not be able to easily use bootstrap plugins others have written with this.

However with a default Angular UI & copy of bootstrap then you'll need jQuery as the code in the github repository has been heavily modified to work without jQuery.

[Edit] As noted in the comments UI Bootstrap is a very good option as well.