下三者是同樣效果
angular.element 最主要是當jQuery可用時自動引用 jQuery(), 若不可用則自動引用 jqLite(jQuey精簡版). 但其可用的方法則有限定
var target = document.getElementById('appBusyIndicator');<br /> var target = angular.element('#appBusyIndicator');<br /> var target = $('#appBusyIndicator');
angular.element 最主要是當jQuery可用時自動引用 jQuery(), 若不可用則自動引用 jqLite(jQuey精簡版). 但其可用的方法則有限定
Angular's jqLite
jqLite 僅提供下列 jQuery 方法
- addClass()
- after()
- append()
- attr() - Does not support functions as parameters
- bind() - Does not support namespaces, selectors or eventData
- children() - Does not support selectors
- clone()
- contents()
- css() - Only retrieves inline-styles, does not call getComputedStyle()
- data()
- detach()
- empty()
- eq()
- find() - Limited to lookups by tag name
- hasClass()
- html()
- next() - Does not support selectors
- on() - Does not support namespaces, selectors or eventData
- off() - Does not support namespaces or selectors
- one() - Does not support namespaces or selectors
- parent() - Does not support selectors
- prepend()
- prop()
- ready()
- remove()
- removeAttr()
- removeClass()
- removeData()
- replaceWith()
- text()
- toggleClass()
- triggerHandler() - Passes a dummy event object to handlers.
- unbind() - Does not support namespaces
- val()
- wrap()