?
Ce document utilise Manuel du site Web PHP chinois Libérer
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.
名稱 | 描述 |
---|---|
angular.lowercase |
轉換指定的字符串到小寫。 |
angular.uppercase |
Converts the specified string to uppercase. |
angular.forEach |
Invokes the |
angular.extend |
Extends the destination object |
angular.noop |
A function that performs no operations. 這個函數(shù)在使用函數(shù)風格寫代碼時很有用。
|
angular.identity |
A function that returns its first argument. This function is useful when writing code in the functional style. |
angular.isUndefined |
檢測引用是否未定義。 |
angular.isDefined |
檢測引用是否已定義。 |
angular.isObject |
檢測引用是否為一個 |
angular.isString |
檢測引用是否是一個 |
angular.isNumber |
檢測引用是否是一個 |
angular.isDate |
檢測值是否為日期。 |
angular.isArray |
檢測引用是否為一個 |
angular.isFunction |
檢測引用是否是一個 |
angular.isElement |
檢測引用是否為一個DOM元素(或是封裝的jQuery元素)。 |
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 angular uses this notation internally. |
angular.fromJson |
反序列化JSON字符串。 |
angular.bootstrap |
Use this function to manually start up angular application. |
angular.injector |
Creates an injector function that can be used for retrieving services as well as for 依賴注入 (see 依賴注入). |
angular.element |
Wraps a raw DOM element or HTML string as a jQuery element. |
angular.module |
The |
名稱 | 描述 |
---|---|
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 Angular markup like |
ngSrc |
Using Angular markup like |
ngSrcset |
Using Angular markup like |
ngDisabled |
The following markup will make the button enabled on Chrome/Firefox but not on IE8 and older IEs:
|
ngChecked |
HTML規(guī)范不要求瀏覽器對布爾型屬性必須給出值,例如checked(它們存在表示true,不存在表示false)。
如果我們放置了一個Angular動態(tài)表達式到這樣的屬性上,在瀏覽器刪除屬性時綁定信息將會丟失。
The |
ngReadonly |
HTML規(guī)范不要求瀏覽器對布爾型屬性必須給出值,例如readonly(它們存在表示true,不存在表示false)。
如果我們放置了一個Angular動態(tài)表達式到這樣的屬性上,在瀏覽器刪除屬性時綁定信息將會丟失。
The |
ngSelected |
HTML規(guī)范不要求瀏覽器對布爾型屬性必須給出值,例如selected(它們存在表示true,不存在表示false)。
如果我們放置了一個Angular動態(tài)表達式到這樣的屬性上,在瀏覽器刪除屬性時綁定信息將會丟失。
The |
ngOpen |
HTML規(guī)范不要求瀏覽器對布爾型屬性必須給出值,例如open(它們存在表示true,不存在表示false)。
如果我們放置了一個Angular動態(tài)表達式到這樣的屬性上,在瀏覽器刪除屬性時綁定信息將會丟失。
The |
ngForm |
可嵌套的 |
form |
Directive that instantiates FormController. |
textarea |
HTML textarea element control with angular 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 with angular data-binding. Input control follows HTML5 input types and polyfills the HTML5 validation behavior for older browsers. |
ngModel |
The |
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). The expression is not evaluated when the value change is coming from the model. |
ngList |
Text input that converts between a delimited string and an array of strings. The delimiter can be a fixed string (by default a comma) or a regular expression. |
ngValue |
Binds the given expression to the value of |
ngModelOptions |
Allows tuning how model updates are done. Using |
ngBind |
The |
ngBindTemplate |
The |
ngBindHtml |
Creates a binding that will innerHTML the result of evaluating the |
ngClass |
The |
ngClassOdd |
The |
ngClassEven |
The |
ngCloak |
The |
ngController |
The |
ngCsp |
Enables CSP (Content Security Policy) support. |
ngClick |
The ngClick directive allows you to specify custom behavior when an element is clicked. |
ngDblclick |
The |
ngMousedown |
The ngMousedown directive allows you to 指定自定義行為到mousedown事件上。 |
ngMouseup |
指定自定義行為到mouseup事件上。 |
ngMouseover |
指定自定義行為到mouseover事件上。 |
ngMouseenter |
指定自定義行為到mouseenter事件上。 |
ngMouseleave |
指定自定義行為到mouseleave事件上。 |
ngMousemove |
指定自定義行為到mousemove事件上。 |
ngKeydown |
指定自定義行為到keydown事件上。 |
ngKeyup |
指定自定義行為到keyup事件上。 |
ngKeypress |
指定自定義行為到keypress事件上。 |
ngSubmit |
Enables binding Angular表達式s to onsubmit events. |
ngFocus |
指定自定義行為到focus事件上。 |
ngBlur |
指定自定義行為到blur事件上。 |
ngCopy |
指定自定義行為到copy事件上。 |
ngCut |
為剪切事件指定自定義行為。 |
ngPaste |
指定自定義行為到paste事件上。 |
ngIf |
The |
ngInclude |
Fetches, compiles and includes an external HTML fragment. |
ngInit |
The |
ngNonBindable |
The |
ngPluralize |
|
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 |
名稱 | 描述 |
---|---|
angular.version |
An object that contains information about the current AngularJS version. This object has the following properties: |
名稱 | 描述 |
---|---|
angular.Module |
Interface for configuring angular modules. |
$cacheFactory.Cache |
A cache object used to store and retrieve data, primarily used by $http 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 |
|
$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.) |
名稱 | 描述 |
---|---|
$anchorScroll |
When called, it checks current value of |
$animate |
The $animate service provides rudimentary DOM manipulation functions to insert, remove and move elements within the DOM, as well as adding and removing classes. This service is the core service used by the ngAnimate $animator service which provides high-level animation hooks for CSS and JavaScript. |
$cacheFactory |
Factory that constructs Cache objects and gives access to them. |
$templateCache |
The first time a template is used, it is loaded in the template cache for quick retrieval. You
can load templates directly into the cache in a |
$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 Angular表達式s is delegated to this service.
The default implementation simply delegates to |
$filter |
Filters are used for formatting data displayed to the user. |
$http |
The |
$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 |
Angular's wrapper for |
$locale |
$locale service provides localization rules for various Angular 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 Angular expression into a function. |
$q |
A promise/deferred implementation inspired by Kris Kowal's Q. |
$rootElement |
The root element of Angular 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 an event emission/broadcast and subscription facility. See the developer guide on scopes. |
$sceDelegate |
|
$sce |
|
$timeout |
Angular's wrapper for |
$window |
A reference to the browser's |
名稱 | 描述 |
---|---|
$animateProvider |
Default implementation of $animate that doesn't perform any animations, instead just synchronously performs DOM updates and calls done() callbacks. |
$compileProvider | |
$controllerProvider |
The $controller service is used by Angular 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 |
|
$rootScopeProvider |
Provider for the $rootScope service. |
$sceDelegateProvider |
The |
$sceProvider |
The $sceProvider provider allows developers to configure the $sce service.
|
名稱 | 描述 |
---|---|
input[text] |
Standard HTML text input with angular data binding. |
input[date] |
目前的瀏覽器還不支持HTML5的日期輸入控件,所以將使用文本輸入。 在這種情況下,輸入的文本必須符合ISO-8601的日期格式(yyyy-MM-dd)的校驗規(guī)范,例如:
|
input[dateTimeLocal] |
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), 例如: |
input[time] |
Input with time 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 time format (HH:mm), 例如: |
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##), 例如: |
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), 例如: |
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[checkbox] |
HTML checkbox. |
名稱 | 描述 |
---|---|
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 or string, as specified by
the value and sign (positive or negative) of |
orderBy |
Orders a specified |