AngularJS ngJq Directive

  • The ngJq directive in angularJS is used to specifies the application must use a library (like angular.element)
  • This directive force either jqLite by leaving ng-jq blank or sets the name of the jquery variable under window. (Eg. jQuery)
  • jQLite is a subset of jQuery that is directly built into AngularJS. By default, AngularJS use jQLite.
  • Use jQuery, load the jQuery library before loading the AngularJS then angular will skip jQLite and it will start to use jQuery library.
  • This directive executes at priority level 0.

Syntax for ngJq Directive in AngularJS:

<element ng-jq="string"></element>

Parameter value

Value Type Description
ng-jq string It specifies the name of the library available under window to be used for angular.element.

jQuery Methods:

  • Some of the following jquery methods supported by jQLite.

jQuery Methods Description
addclass () It is used to adds the specified class to each element in the set of matched elements.
after() It is used to insert content, specified by the parameter, after each element in the set of matched elements.
append() It is used to inserts the specified content as the last child of each element in the jQuery collection.
attr() It is used to gets the attribute value for only the first elements in the matched set.
bind() It is used to attach a handler to an event for the elements.
children() It does not support the selectors.
clone() It is used to create a deep copy of the set of matched elements.
contents() It is used to get the children of each element in the set of matched elements, including text and comment nodes.
css() It is used to sets the one or more css properties for every matched element.

Related Searches to angularjs ngFocus directive