ng
The ng module is loaded by default when an AngularJS application is started. The module itself contains the essential components for an AngularJS application to function. The table below lists a high level breakdown of each of the services/factories, filters, directives and testing components available within this core module.
Name | Description |
---|---|
angular.merge |
This is a list of (known) object types that are not handled correctly by this function:
|
angular.toJson |
The Safari browser throws a
See https://github.com/angular/angular.js/pull/14221 for more information. |
angular.element |
You cannot spy on |
$compile |
Double CompilationDouble compilation occurs when an already compiled part of the DOM gets compiled again. This is an undesired effect and can lead to misbehaving directives, performance issues, and memory leaks. Refer to the Compiler Guide section on double compilation for an in-depth explanation and ways to avoid it. Issues with
|
input[number] |
HTML5 constraint validation and
|
textarea |
When specifying the You can work around this Internet Explorer issue by using |
ngClass |
You should not use interpolation in the value of the |
ngStyle |
You should not use interpolation in the value of the |
select |
In Firefox, the select model is only updated when the select element is blurred. For example, when switching between options with the keyboard, the select model is only set to the currently selected option when the select is blurred, e.g via tab key or clicking the mouse outside the select. This is due to an ambiguity in the select element specification. See the issue on the Firefox bug tracker for more information, and this Github comment for a workaround |
$interpolate |
It is currently not possible for an interpolated expression to contain the interpolation end
symbol. For example, All directives and components must use the standard
The workaround is to ensure that such instances are separated by whitespace:
See https://github.com/angular/angular.js/pull/14610#issuecomment-219401099 for more information. |
Name | Description |
---|---|
angular.forEach | Invokes the |
angular.extend | Extends the destination object |
angular.merge | Deeply extends the destination object |
angular.noop | A function that performs no operations. This function can be useful when writing code in the functional style.
|
angular.identity | A function that returns its first argument. This function is useful when writing code in the functional style. |
angular.isUndefined | Determines if a reference is undefined. |
angular.isDefined | Determines if a reference is defined. |
angular.isObject | Determines if a reference is an |
angular.isString | Determines if a reference is a |
angular.isNumber | Determines if a reference is a |
angular.isDate | Determines if a value is a date. |
angular.isArray | Determines if a reference is an |
angular.isFunction | Determines if a reference is a |
angular.isElement | Determines if a reference is a DOM element (or wrapped jQuery element). |
angular.copy | Creates a deep copy of |
angular.equals | Determines if two objects or two values are equivalent. Supports value types, regular expressions, arrays and objects. |
angular.bind | Returns a function which calls function |
angular.toJson | Serializes input into a JSON-formatted string. Properties with leading $$ characters will be stripped since AngularJS uses this notation internally. |
angular.fromJson | Deserializes a JSON string. |
angular.bootstrap | Use this function to manually start up AngularJS application. |
angular.reloadWithDebugInfo | Use this function to reload the current application with debug information turned on.
This takes precedence over a call to |
angular.injector | Creates an injector object that can be used for retrieving services as well as for dependency injection (see dependency injection). |
angular.element | Wraps a raw DOM element or HTML string as a jQuery element. |
angular.module | The |
angular.errorHandlingConfig | Configure several aspects of error handling in AngularJS if used as a setter or return the current configuration if used as a getter. The following options are supported: |
Name | Description |
---|---|
ngJq | Use this directive to force the angular.element library. This should be used to force either jqLite by leaving ng-jq blank or setting the name of the jquery variable under window (eg. jQuery). |
ngApp | Use this directive to auto-bootstrap an AngularJS application. The |
a | Modifies the default behavior of the html a tag so that the default action is prevented when the href attribute is empty. |
ngHref | Using AngularJS markup like |
ngSrc | Using AngularJS markup like |
ngSrcset | Using AngularJS markup like |
ngDisabled | This directive sets the |
ngChecked | Sets the |
ngReadonly | Sets the |
ngSelected | Sets the |
ngOpen | Sets the |
ngForm | Helper directive that makes it possible to create control groups inside a
|
form | Directive that instantiates FormController. |
textarea | HTML textarea element control with AngularJS data-binding. The data-binding and validation properties of this element are exactly the same as those of the input element. |
input | HTML input element control. When used together with |
ngValue | Binds the given expression to the value of the element. |
ngBind | The |
ngBindTemplate | The |
ngBindHtml | Evaluates the expression and inserts the resulting HTML into the element in a secure way. By default,
the resulting HTML content will be sanitized using the $sanitize service.
To utilize this functionality, ensure that |
ngChange | Evaluate the given expression when the user changes the input. The expression is evaluated immediately, unlike the JavaScript onchange event which only triggers at the end of a change (usually, when the user leaves the form element or presses the return key). |
ngClass | The |
ngClassOdd | The |
ngClassEven | The |
ngCloak | The |
ngController | The |
ngCsp | AngularJS has some features that can conflict with certain restrictions that are applied when using CSP (Content Security Policy) rules. |
ngClick | The ngClick directive allows you to specify custom behavior when an element is clicked. |
ngDblclick | The |
ngMousedown | The ngMousedown directive allows you to specify custom behavior on mousedown event. |
ngMouseup | Specify custom behavior on mouseup event. |
ngMouseover | Specify custom behavior on mouseover event. |
ngMouseenter | Specify custom behavior on mouseenter event. |
ngMouseleave | Specify custom behavior on mouseleave event. |
ngMousemove | Specify custom behavior on mousemove event. |
ngKeydown | Specify custom behavior on keydown event. |
ngKeyup | Specify custom behavior on keyup event. |
ngKeypress | Specify custom behavior on keypress event. |
ngSubmit | Enables binding AngularJS expressions to onsubmit events. |
ngFocus | Specify custom behavior on focus event. |
ngBlur | Specify custom behavior on blur event. |
ngCopy | Specify custom behavior on copy event. |
ngCut | Specify custom behavior on cut event. |
ngPaste | Specify custom behavior on paste event. |
ngIf | The |
ngInclude | Fetches, compiles and includes an external HTML fragment. |
ngInit | The |
ngList | Text input that converts between a delimited string and an array of strings. The default
delimiter is a comma followed by a space - equivalent to |
ngModel | The |
ngModelOptions | This directive allows you to modify the behaviour of |
ngNonBindable | The |
ngOptions | The |
ngPluralize |
|
ngRef | The |
ngRepeat | The |
ngShow | The |
ngHide | The |
ngStyle | The |
ngSwitch | The |
ngTransclude | Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion. |
script | Load the content of a |
select | HTML |
ngRequired | ngRequired adds the required |
ngPattern | ngPattern adds the pattern |
ngMaxlength | ngMaxlength adds the maxlength |
ngMinlength | ngMinlength adds the minlength |
Name | Description |
---|---|
angular.version | An object that contains information about the current AngularJS version. |
Name | Description |
---|---|
angular.Module | Interface for configuring AngularJS modules. |
$cacheFactory.Cache | A cache object used to store and retrieve data, primarily used by $templateRequest and the script directive to cache templates and other data. |
$compile.directive.Attributes | A shared object between directive compile / linking functions which contains normalized DOM
element attributes. The values reflect current binding state |
form.FormController |
|
ngModel.NgModelController |
|
ModelOptions | A container for the options set by the |
select.SelectController | The controller for the select directive. The controller exposes a few utility methods that can be used to augment the behavior of a regular or an ngOptions select element. |
$rootScope.Scope | A root scope can be retrieved using the $rootScope key from the $injector. Child scopes are created using the $new() method. (Most scopes are created automatically when compiled HTML template is executed.) See also the Scopes guide for an in-depth introduction and usage examples. |
Name | Description |
---|---|
$anchorScrollProvider | Use |
$animateProvider | Default implementation of $animate that doesn't perform any animations, instead just synchronously performs DOM updates and resolves the returned runner promise. |
$compileProvider | |
$controllerProvider | The $controller service is used by AngularJS to create new controllers. |
$filterProvider | Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To achieve this a filter definition consists of a factory function which is annotated with dependencies and is responsible for creating a filter function. |
$httpProvider | Use |
$interpolateProvider | Used for configuring the interpolation markup. Defaults to |
$locationProvider | Use the |
$logProvider | Use the |
$parseProvider |
|
$qProvider | |
$rootScopeProvider | Provider for the $rootScope service. |
$sceDelegateProvider | The |
$sceProvider | The $sceProvider provider allows developers to configure the $sce service.
|
$templateRequestProvider | Used to configure the options passed to the |
Name | Description |
---|---|
$anchorScroll | When called, it scrolls to the element related to the specified |
$animate | The $animate service exposes a series of DOM utility methods that provide support for animation hooks. The default behavior is the application of DOM operations, however, when an animation is detected (and animations are enabled), $animate will do the heavy lifting to ensure that animation runs with the triggered DOM operation. |
$animateCss | This is the core version of |
$cacheFactory | Factory that constructs Cache objects and gives access to them. |
$templateCache |
|
$compile | Compiles an HTML string or DOM into a template and produces a template function, which
can then be used to link |
$controller |
|
$document | A jQuery or jqLite wrapper for the browser's |
$exceptionHandler | Any uncaught exception in AngularJS expressions is delegated to this service.
The default implementation simply delegates to |
$filter | Filters are used for formatting data displayed to the user. |
$httpParamSerializer | Default |
$httpParamSerializerJQLike | Alternative |
$http | The |
$xhrFactory | Factory function used to create XMLHttpRequest objects. |
$httpBackend | HTTP backend used by the service that delegates to XMLHttpRequest object or JSONP and deals with browser incompatibilities. |
$interpolate | Compiles a string with markup into an interpolation function. This service is used by the HTML $compile service for data binding. See $interpolateProvider for configuring the interpolation markup. |
$interval | AngularJS's wrapper for |
$jsonpCallbacks | This service handles the lifecycle of callbacks to handle JSONP requests. Override this service if you wish to customise where the callbacks are stored and how they vary compared to the requested url. |
$locale | $locale service provides localization rules for various AngularJS components. As of right now the only public api is: |
$location | The $location service parses the URL in the browser address bar (based on the window.location) and makes the URL available to your application. Changes to the URL in the address bar are reflected into $location service and changes to $location are reflected into the browser address bar. |
$log | Simple service for logging. Default implementation safely writes the message into the browser's console (if present). |
$parse | Converts AngularJS expression into a function. |
$q | A service that helps you run functions asynchronously, and use their return values (or exceptions) when they are done processing. |
$rootElement | The root element of AngularJS application. This is either the element where ngApp was declared or the element passed into
|
$rootScope | Every application has a single root scope. All other scopes are descendant scopes of the root scope. Scopes provide separation between the model and the view, via a mechanism for watching the model for changes. They also provide event emission/broadcast and subscription facility. See the developer guide on scopes. |
$sceDelegate |
|
$sce |
|
$templateRequest | The |
$timeout | AngularJS's wrapper for |
$window | A reference to the browser's |
Name | Description |
---|---|
input[text] | Standard HTML text input with AngularJS data binding, inherited by most of the |
input[date] | Input with date validation and transformation. In browsers that do not yet support
the HTML5 date input, a text element will be used. In that case, text must be entered in a valid ISO-8601
date format (yyyy-MM-dd), for example: |
input[datetime-local] | Input with datetime validation and transformation. In browsers that do not yet support
the HTML5 date input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
local datetime format (yyyy-MM-ddTHH:mm:ss), for example: |
input[time] | Input with time validation and transformation. In browsers that do not yet support
the HTML5 time input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
local time format (HH:mm:ss), for example: |
input[week] | Input with week-of-the-year validation and transformation to Date. In browsers that do not yet support
the HTML5 week input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
week format (yyyy-W##), for example: |
input[month] | Input with month validation and transformation. In browsers that do not yet support
the HTML5 month input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
month format (yyyy-MM), for example: |
input[number] | Text input with number validation and transformation. Sets the |
input[url] | Text input with URL validation. Sets the |
input[email] | Text input with email validation. Sets the |
input[radio] | HTML radio button. |
input[range] | Native range input with validation and transformation. |
input[checkbox] | HTML checkbox. |
Name | Description |
---|---|
filter | Selects a subset of items from |
currency | Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default symbol for current locale is used. |
number | Formats a number as text. |
date | Formats |
json | Allows you to convert a JavaScript object into JSON string. |
lowercase | Converts string to lowercase. |
uppercase | Converts string to uppercase. |
limitTo | Creates a new array or string containing only a specified number of elements. The elements are
taken from either the beginning or the end of the source array, string or number, as specified by
the value and sign (positive or negative) of |
orderBy | Returns an array containing the items from the specified |