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/)

你可能感兴趣的:(Angular内嵌jqlite语法大全)