Jqlite: A Tribute to jquery
In the DOM operation, no one is better than jquery. Angularjs in a special way to show respect to jquery: The built-in compact version of Jquery-jqlite.
like jquery, Jqlite is compatible with multiple browsers.
**jqlite** is provided as a ' angular.element ' interface, compatible with a subset of the jquery API. The element objects in all APIs in Angularjs are not pure DOM objects, but are encapsulated by Jqlite.
problems with selectors
From a developer's perspective, the most obvious simplification of jqlite is that it does not support selectors. You can only pass a DOM object to angular.element. It looks like Angularjs this part of the functionality to browser native support, and we can get a DOM object using the browser's queryselector first:
var TPL = document.queryselector (' #clock ');
Angular.element (TPL). Text (...);
compatibility of jquery libraries
If you don't want to use jqlite for some reason, you can also introduce the jquery library before Angularjs. ANGULARJS automatically upgrades Jqlite to Jquery,angular.element equals $. This allows you to use a familiar selector.
Methods of extension
Jqlite includes some additional methods to accommodate the ANGULARJS framework:
Controller (name)-Gets the controller object corresponding to the element
Injector ()-Gets the injector object corresponding to the element
Scope ()-Gets the scope object corresponding to the element
Isolatescope ()-Gets the isolation scope object corresponding to the element, if any.
Inheriteddata ()-Same as data (), but if the current element does not have the specified data, it continues to look for the parent node.
Extended Events
Jqlite also provides a $destroy event that, when the DOM object is removed from the DOM tree, triggers the event to be triggered by the ANGULARJS to order some cleanup work.
This article turns from: http://www.hubwiz.com/class/54f3ba65e564e50cfccbad4b