Angular内嵌jqlite语法大全

AngularJS强化了前端的MVC逻辑,却弱化了Jquery的Dom操作能力。

好在Angular自身也考虑到这个问题,所以它自身内置了jqLite来弥补这方面的不足。

同时它提供了jqlite的封装方法:angular.element(ele),相当于jquery的$

但建议使用时可以在全局处设置

`var $ = function(ele){

if(typeof ele == "string"){

ele = document.querySelectorAll(ele);

}

return angular.element(ele);

};

但jqLite只有一部分Jquery的语法,很多小伙伴可能都找不到jqlite的API,所以我这里就列举一下

* jqLite provides only the following jQuery methods:

*

* – [`addClass()`](http://api.jquery.com/addClass/)

* – [`after()`](http://api.jquery.com/after/)

* – [`append()`](http://api.jquery.com/append/)

* – [`attr()`](http://api.jquery.com/attr/)

* – [`bind()`](http://api.jquery.com/on/) – Does not support namespaces, selectors or eventData

* – [`children()`](http://api.jquery.com/children/) – Does not support selectors

* – [`clone()`](http://api.jquery.com/clone/)

* – [`contents()`](http://api.jquery.com/contents/)

* – [`css()`](http://api.jquery.com/css/)

* – [`data()`](http://api.jquery.com/data/)

* – [`empty()`](http://api.jquery.com/empty/)

* – [`eq()`](http://api.jquery.com/eq/)

* – [`find()`](http://api.jquery.com/find/) – Limited to lookups by tag name

* – [`hasClass()`](http://api.jquery.com/hasClass/)

* – [`html()`](http://api.jquery.com/html/)

* – [`next()`](http://api.jquery.com/next/) – Does not support selectors

* – [`on()`](http://api.jquery.com/on/) – Does not support namespaces, selectors or eventData

* – [`off()`](http://api.jquery.com/off/) – Does not support namespaces or selectors

* – [`one()`](http://api.jquery.com/one/) – Does not support namespaces or selectors

* – [`parent()`](http://api.jquery.com/parent/) – Does not support selectors

* – [`prepend()`](http://api.jquery.com/prepend/)

* – [`prop()`](http://api.jquery.com/prop/)

* – [`ready()`](http://api.jquery.com/ready/)

* – [`remove()`](http://api.jquery.com/remove/)

* – [`removeAttr()`](http://api.jquery.com/removeAttr/)

* – [`removeClass()`](http://api.jquery.com/removeClass/)

* – [`removeData()`](http://api.jquery.com/removeData/)

* – [`replaceWith()`](http://api.jquery.com/replaceWith/)

* – [`text()`](http://api.jquery.com/text/)

* – [`toggleClass()`](http://api.jquery.com/toggleClass/)

* – [`triggerHandler()`](http://api.jquery.com/triggerHandler/) – Passes a dummy event object to handlers.

* – [`unbind()`](http://api.jquery.com/off/) – Does not support namespaces

* – [`val()`](http://api.jquery.com/val/)

* – [`wrap()`](http://api.jquery.com/wrap/)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的阅读 14,595评论 5 6
  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    passiontim阅读 15,672评论 2 45
  • 指令 ng- ng-app ng-model ng-eventType ng-controller 指令都写在ht...
    硕鼠宝阅读 4,447评论 0 4
  • 带着对留学生活的憧憬和对祖国的眷念我来到意大利。时间过得很快,转眼离开我亲爱的祖国已经半年多了。这短短的留学生活是...
    意生意色阅读 3,126评论 0 1
  • 曹州马生,性豪放善施。方与邻人子赵生对烛饮,忽觉其腹剧然作痛,不能行动。因唤家人,则生转侧床间,频以号呼,汗浃席榻...
    0李小乙0阅读 2,773评论 2 0