How to implement the jquery selector function using angular

Source: Internet
Author: User

1. $event Object $event object is actually a potential jquery event object,get this element through $event.target, get child elements through $event.currenttarget。 For example:
<li ng-click= "Getapplicationlistbytype (1, $event)" ><a> Medical health </a></li>
Get a list of services by type
$scope. Getservicelistbytype = function (item,e) {
Console.log ("$event:", e);
Console.log ("$event. Target:", e.target);
Console.log ("$event. Currenttarget:", e.currenttarget);
}
The output is as follows:

2. $event and angular.element implement the jquery selector function 
Get a list of services by type
$scope. Getservicelistbytype = function (item,e) {
var obj = E.currenttarget;
Angular.element (obj). addclass (' active ');
var childobj = E.target;
Angular.element (childobj). addclass (");

}
3. Angular.element
Angular ' s jqlite

Jqlite provides only the following jQuery methods:

  • 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 no callgetComputedStyle()
  • 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()

How to implement the jquery selector function using angular

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.