docs(*): add / correct @-tags; fix headlines; add info

- add / correct `@param`, `@restrict`, `@element`, `@priorìty` to directives
- use `@animations` instead of manual headings
- fix more incorrect h1 headings
- fix incorrectly indented `<examples>`
- add some info to $templateCache and $templateRequest
This commit is contained in:
Martin Staffa
2017-10-05 17:16:13 +02:00
committed by Martin Staffa
parent e5c6174839
commit 2c8bfd8a08
21 changed files with 257 additions and 199 deletions
+2 -2
View File
@@ -232,8 +232,8 @@ triggered:
| {@link ng.directive:ngClass#animations ngClassEven / ngClassOdd} | add and remove |
| {@link ng.directive:ngHide#animations ngHide} | add and remove (the `ng-hide` class) |
| {@link ng.directive:ngShow#animations ngShow} | add and remove (the `ng-hide` class) |
| {@link ng.directive:ngModel#animation-hooks ngModel} | add and remove ({@link ng.directive:ngModel#css-classes various classes}) |
| {@link ng.directive:form#animation-hooks form / ngForm} | add and remove ({@link ng.directive:form#css-classes various classes}) |
| {@link ng.directive:ngModel#animations ngModel} | add and remove ({@link ng.directive:ngModel#css-classes various classes}) |
| {@link ng.directive:form#animations form / ngForm} | add and remove ({@link ng.directive:form#css-classes various classes}) |
| {@link module:ngMessages#animations ngMessages} | add and remove (the `ng-active`/`ng-inactive` classes) |
For a full breakdown of the steps involved during each animation event, refer to the
+8
View File
@@ -1594,6 +1594,10 @@ var isAutoBootstrapAllowed = allowAutoBootstrap(window.document);
* document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`
* would not be resolved to `3`.
*
* @example
*
* ### Simple Usage
*
* `ngApp` is the easiest, and most common way to bootstrap an application.
*
<example module="ngAppDemo" name="ng-app">
@@ -1610,6 +1614,10 @@ var isAutoBootstrapAllowed = allowAutoBootstrap(window.document);
</file>
</example>
*
* @example
*
* ### With `ngStrictDi`
*
* Using `ngStrictDi`, you would see something like this:
*
<example ng-app-included="true" name="strict-di">
+9 -8
View File
@@ -106,8 +106,8 @@ function $CacheFactoryProvider() {
*
* @description
* A cache object used to store and retrieve data, primarily used by
* {@link $http $http} and the {@link ng.directive:script script} directive to cache
* templates and other data.
* {@link $templateRequest $templateRequest} and the {@link ng.directive:script script}
* directive to cache templates and other data.
*
* ```js
* angular.module('superCache')
@@ -360,9 +360,12 @@ function $CacheFactoryProvider() {
* @this
*
* @description
* `$templateCache` is a {@link $cacheFactory.Cache Cache object} created by the
* {@link ng.$cacheFactory $cacheFactory}.
*
* 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 `script` tag, or by consuming the
* `$templateCache` service directly.
* can load templates directly into the cache in a `script` tag, by using {@link $templateRequest},
* or by consuming the `$templateCache` service directly.
*
* Adding via the `script` tag:
*
@@ -373,8 +376,8 @@ function $CacheFactoryProvider() {
* ```
*
* **Note:** the `script` tag containing the template does not need to be included in the `head` of
* the document, but it must be a descendent of the {@link ng.$rootElement $rootElement} (IE,
* element with ng-app attribute), otherwise the template will be ignored.
* the document, but it must be a descendent of the {@link ng.$rootElement $rootElement} (e.g.
* element with {@link ngApp} attribute), otherwise the template will be ignored.
*
* Adding via the `$templateCache` service:
*
@@ -397,8 +400,6 @@ function $CacheFactoryProvider() {
* $templateCache.get('templateId.html')
* ```
*
* See {@link ng.$cacheFactory $cacheFactory}.
*
*/
function $TemplateCacheProvider() {
this.$get = ['$cacheFactory', function($cacheFactory) {
+1 -2
View File
@@ -415,8 +415,7 @@ addSetValidityMethod({
* submitted. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`
* to have access to the updated model.
*
* ## Animation Hooks
*
* @animations
* Animations in ngForm are triggered when any of the associated CSS classes are added and removed.
* These classes are: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any
* other validations that are performed within the form. Animations in ngForm are similar to how
+3 -1
View File
@@ -2086,6 +2086,8 @@ var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
/**
* @ngdoc directive
* @name ngValue
* @restrict A
* @priority 100
*
* @description
* Binds the given expression to the value of the element.
@@ -2098,7 +2100,7 @@ var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
* It can also be used to achieve one-way binding of a given expression to an input element
* such as an `input[text]` or a `textarea`, when that element does not use ngModel.
*
* @element input
* @element ANY
* @param {string=} ngValue AngularJS expression, whose value will be bound to the `value` attribute
* and `value` property of the element.
*
+2 -1
View File
@@ -3,6 +3,7 @@
/**
* @ngdoc directive
* @name ngChange
* @restrict A
*
* @description
* Evaluate the given expression when the user changes the input.
@@ -21,7 +22,7 @@
*
* Note, this directive requires `ngModel` to be present.
*
* @element input
* @element ANY
* @param {expression} ngChange {@link guide/expression Expression} to evaluate upon change
* in input value.
*
+12 -11
View File
@@ -143,6 +143,7 @@ function classDirective(name, selector) {
* @ngdoc directive
* @name ngClass
* @restrict AC
* @element ANY
*
* @description
* The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding
@@ -178,14 +179,21 @@ function classDirective(name, selector) {
* | {@link ng.$animate#addClass addClass} | just before the class is applied to the element |
* | {@link ng.$animate#removeClass removeClass} | just before the class is removed from the element |
*
* @element ANY
* ### ngClass and pre-existing CSS3 Transitions/Animations
The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure.
Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder
any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure
to view the step by step details of {@link $animate#addClass $animate.addClass} and
{@link $animate#removeClass $animate.removeClass}.
*
* @param {expression} ngClass {@link guide/expression Expression} to eval. The result
* of the evaluation can be a string representing space delimited class
* names, an array, or a map of class names to boolean values. In the case of a map, the
* names of the properties whose values are truthy will be added as css classes to the
* element.
*
* @example Example that demonstrates basic bindings via ngClass directive.
* @example
* ### Basic
<example name="ng-class">
<file name="index.html">
<p ng-class="{strike: deleted, bold: important, 'has-error': error}">Map Syntax Example</p>
@@ -275,7 +283,8 @@ function classDirective(name, selector) {
</file>
</example>
## Animations
@example
### Animations
The example below demonstrates how to perform animations using ngClass.
@@ -313,14 +322,6 @@ function classDirective(name, selector) {
});
</file>
</example>
## ngClass and pre-existing CSS3 Transitions/Animations
The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure.
Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder
any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure
to view the step by step details of {@link $animate#addClass $animate.addClass} and
{@link $animate#removeClass $animate.removeClass}.
*/
var ngClassDirective = classDirective('', true);
+106 -105
View File
@@ -78,6 +78,7 @@
* E.g.`<body ng-csp="no-inline-style;no-unsafe-eval">`
*
* @example
*
* This example shows how to apply the `ngCsp` directive to the `html` tag.
```html
<!doctype html>
@@ -86,122 +87,122 @@
...
</html>
```
* @example
<!-- Note: the `.csp` suffix in the example name triggers CSP mode in our http server! -->
<example name="example.csp" module="cspExample" ng-csp="true">
<file name="index.html">
<div ng-controller="MainController as ctrl">
<div>
<button ng-click="ctrl.inc()" id="inc">Increment</button>
<span id="counter">
{{ctrl.counter}}
</span>
</div>
<div>
<button ng-click="ctrl.evil()" id="evil">Evil</button>
<span id="evilError">
{{ctrl.evilError}}
</span>
</div>
</div>
</file>
<file name="script.js">
angular.module('cspExample', [])
.controller('MainController', function MainController() {
this.counter = 0;
this.inc = function() {
this.counter++;
};
this.evil = function() {
try {
eval('1+2'); // eslint-disable-line no-eval
} catch (e) {
this.evilError = e.message;
}
};
});
</file>
<file name="protractor.js" type="protractor">
var util, webdriver;
<!-- Note: the `.csp` suffix in the example name triggers CSP mode in our http server! -->
<example name="example.csp" module="cspExample" ng-csp="true">
<file name="index.html">
<div ng-controller="MainController as ctrl">
<div>
<button ng-click="ctrl.inc()" id="inc">Increment</button>
<span id="counter">
{{ctrl.counter}}
</span>
</div>
var incBtn = element(by.id('inc'));
var counter = element(by.id('counter'));
var evilBtn = element(by.id('evil'));
var evilError = element(by.id('evilError'));
function getAndClearSevereErrors() {
return browser.manage().logs().get('browser').then(function(browserLog) {
return browserLog.filter(function(logEntry) {
return logEntry.level.value > webdriver.logging.Level.WARNING.value;
});
});
}
function clearErrors() {
getAndClearSevereErrors();
}
function expectNoErrors() {
getAndClearSevereErrors().then(function(filteredLog) {
expect(filteredLog.length).toEqual(0);
if (filteredLog.length) {
console.log('browser console errors: ' + util.inspect(filteredLog));
<div>
<button ng-click="ctrl.evil()" id="evil">Evil</button>
<span id="evilError">
{{ctrl.evilError}}
</span>
</div>
</div>
</file>
<file name="script.js">
angular.module('cspExample', [])
.controller('MainController', function MainController() {
this.counter = 0;
this.inc = function() {
this.counter++;
};
this.evil = function() {
try {
eval('1+2'); // eslint-disable-line no-eval
} catch (e) {
this.evilError = e.message;
}
});
};
});
</file>
<file name="protractor.js" type="protractor">
var util, webdriver;
var incBtn = element(by.id('inc'));
var counter = element(by.id('counter'));
var evilBtn = element(by.id('evil'));
var evilError = element(by.id('evilError'));
function getAndClearSevereErrors() {
return browser.manage().logs().get('browser').then(function(browserLog) {
return browserLog.filter(function(logEntry) {
return logEntry.level.value > webdriver.logging.Level.WARNING.value;
});
});
}
function clearErrors() {
getAndClearSevereErrors();
}
function expectNoErrors() {
getAndClearSevereErrors().then(function(filteredLog) {
expect(filteredLog.length).toEqual(0);
if (filteredLog.length) {
console.log('browser console errors: ' + util.inspect(filteredLog));
}
});
}
function expectError(regex) {
getAndClearSevereErrors().then(function(filteredLog) {
var found = false;
filteredLog.forEach(function(log) {
if (log.message.match(regex)) {
found = true;
}
});
if (!found) {
throw new Error('expected an error that matches ' + regex);
}
});
function expectError(regex) {
getAndClearSevereErrors().then(function(filteredLog) {
var found = false;
filteredLog.forEach(function(log) {
if (log.message.match(regex)) {
found = true;
}
});
if (!found) {
throw new Error('expected an error that matches ' + regex);
}
});
}
beforeEach(function() {
util = require('util');
webdriver = require('selenium-webdriver');
});
beforeEach(function() {
util = require('util');
webdriver = require('selenium-webdriver');
});
// For now, we only test on Chrome,
// as Safari does not load the page with Protractor's injected scripts,
// and Firefox webdriver always disables content security policy (#6358)
if (browser.params.browser !== 'chrome') {
return;
}
// For now, we only test on Chrome,
// as Safari does not load the page with Protractor's injected scripts,
// and Firefox webdriver always disables content security policy (#6358)
if (browser.params.browser !== 'chrome') {
return;
}
it('should not report errors when the page is loaded', function() {
// clear errors so we are not dependent on previous tests
clearErrors();
// Need to reload the page as the page is already loaded when
// we come here
browser.driver.getCurrentUrl().then(function(url) {
browser.get(url);
});
expectNoErrors();
});
it('should not report errors when the page is loaded', function() {
// clear errors so we are not dependent on previous tests
clearErrors();
// Need to reload the page as the page is already loaded when
// we come here
browser.driver.getCurrentUrl().then(function(url) {
browser.get(url);
});
expectNoErrors();
});
it('should evaluate expressions', function() {
expect(counter.getText()).toEqual('0');
incBtn.click();
expect(counter.getText()).toEqual('1');
expectNoErrors();
});
it('should evaluate expressions', function() {
expect(counter.getText()).toEqual('0');
incBtn.click();
expect(counter.getText()).toEqual('1');
expectNoErrors();
});
it('should throw and report an error when using "eval"', function() {
evilBtn.click();
expect(evilError.getText()).toMatch(/Content Security Policy/);
expectError(/Content Security Policy/);
});
</file>
</example>
it('should throw and report an error when using "eval"', function() {
evilBtn.click();
expect(evilError.getText()).toMatch(/Content Security Policy/);
expectError(/Content Security Policy/);
});
</file>
</example>
*/
// `ngCsp` is not implemented as a proper directive any more, because we need it be processed while
+50 -33
View File
@@ -3,13 +3,14 @@
/**
* @ngdoc directive
* @name ngClick
* @restrict A
* @element ANY
* @priority 0
*
* @description
* The ngClick directive allows you to specify custom behavior when
* an element is clicked.
*
* @element ANY
* @priority 0
* @param {expression} ngClick {@link guide/expression Expression} to evaluate upon
* click. ({@link guide/expression#-event- Event object is available as `$event`})
*
@@ -79,12 +80,13 @@ forEach(
/**
* @ngdoc directive
* @name ngDblclick
* @restrict A
* @element ANY
* @priority 0
*
* @description
* The `ngDblclick` directive allows you to specify custom behavior on a dblclick event.
*
* @element ANY
* @priority 0
* @param {expression} ngDblclick {@link guide/expression Expression} to evaluate upon
* a dblclick. (The Event object is available as `$event`)
*
@@ -103,12 +105,13 @@ forEach(
/**
* @ngdoc directive
* @name ngMousedown
* @restrict A
* @element ANY
* @priority 0
*
* @description
* The ngMousedown directive allows you to specify custom behavior on mousedown event.
*
* @element ANY
* @priority 0
* @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon
* mousedown. ({@link guide/expression#-event- Event object is available as `$event`})
*
@@ -127,12 +130,13 @@ forEach(
/**
* @ngdoc directive
* @name ngMouseup
* @restrict A
* @element ANY
* @priority 0
*
* @description
* Specify custom behavior on mouseup event.
*
* @element ANY
* @priority 0
* @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon
* mouseup. ({@link guide/expression#-event- Event object is available as `$event`})
*
@@ -150,12 +154,13 @@ forEach(
/**
* @ngdoc directive
* @name ngMouseover
* @restrict A
* @element ANY
* @priority 0
*
* @description
* Specify custom behavior on mouseover event.
*
* @element ANY
* @priority 0
* @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon
* mouseover. ({@link guide/expression#-event- Event object is available as `$event`})
*
@@ -174,12 +179,13 @@ forEach(
/**
* @ngdoc directive
* @name ngMouseenter
* @restrict A
* @element ANY
* @priority 0
*
* @description
* Specify custom behavior on mouseenter event.
*
* @element ANY
* @priority 0
* @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon
* mouseenter. ({@link guide/expression#-event- Event object is available as `$event`})
*
@@ -198,12 +204,13 @@ forEach(
/**
* @ngdoc directive
* @name ngMouseleave
* @restrict A
* @element ANY
* @priority 0
*
* @description
* Specify custom behavior on mouseleave event.
*
* @element ANY
* @priority 0
* @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon
* mouseleave. ({@link guide/expression#-event- Event object is available as `$event`})
*
@@ -222,12 +229,13 @@ forEach(
/**
* @ngdoc directive
* @name ngMousemove
* @restrict A
* @element ANY
* @priority 0
*
* @description
* Specify custom behavior on mousemove event.
*
* @element ANY
* @priority 0
* @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon
* mousemove. ({@link guide/expression#-event- Event object is available as `$event`})
*
@@ -246,12 +254,13 @@ forEach(
/**
* @ngdoc directive
* @name ngKeydown
* @restrict A
* @element ANY
* @priority 0
*
* @description
* Specify custom behavior on keydown event.
*
* @element ANY
* @priority 0
* @param {expression} ngKeydown {@link guide/expression Expression} to evaluate upon
* keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
*
@@ -268,12 +277,13 @@ forEach(
/**
* @ngdoc directive
* @name ngKeyup
* @restrict A
* @element ANY
* @priority 0
*
* @description
* Specify custom behavior on keyup event.
*
* @element ANY
* @priority 0
* @param {expression} ngKeyup {@link guide/expression Expression} to evaluate upon
* keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
*
@@ -295,11 +305,12 @@ forEach(
/**
* @ngdoc directive
* @name ngKeypress
* @restrict A
* @element ANY
*
* @description
* Specify custom behavior on keypress event.
*
* @element ANY
* @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon
* keypress. ({@link guide/expression#-event- Event object is available as `$event`}
* and can be interrogated for keyCode, altKey, etc.)
@@ -317,6 +328,9 @@ forEach(
/**
* @ngdoc directive
* @name ngSubmit
* @restrict A
* @element form
* @priority 0
*
* @description
* Enables binding AngularJS expressions to onsubmit events.
@@ -332,8 +346,6 @@ forEach(
* for a detailed discussion of when `ngSubmit` may be triggered.
* </div>
*
* @element form
* @priority 0
* @param {expression} ngSubmit {@link guide/expression Expression} to eval.
* ({@link guide/expression#-event- Event object is available as `$event`})
*
@@ -380,6 +392,9 @@ forEach(
/**
* @ngdoc directive
* @name ngFocus
* @restrict A
* @element window, input, select, textarea, a
* @priority 0
*
* @description
* Specify custom behavior on focus event.
@@ -388,8 +403,6 @@ forEach(
* AngularJS executes the expression using `scope.$evalAsync` if the event is fired
* during an `$apply` to ensure a consistent state.
*
* @element window, input, select, textarea, a
* @priority 0
* @param {expression} ngFocus {@link guide/expression Expression} to evaluate upon
* focus. ({@link guide/expression#-event- Event object is available as `$event`})
*
@@ -400,6 +413,9 @@ forEach(
/**
* @ngdoc directive
* @name ngBlur
* @restrict A
* @element window, input, select, textarea, a
* @priority 0
*
* @description
* Specify custom behavior on blur event.
@@ -412,8 +428,6 @@ forEach(
* AngularJS executes the expression using `scope.$evalAsync` if the event is fired
* during an `$apply` to ensure a consistent state.
*
* @element window, input, select, textarea, a
* @priority 0
* @param {expression} ngBlur {@link guide/expression Expression} to evaluate upon
* blur. ({@link guide/expression#-event- Event object is available as `$event`})
*
@@ -424,12 +438,13 @@ forEach(
/**
* @ngdoc directive
* @name ngCopy
* @restrict A
* @element window, input, select, textarea, a
* @priority 0
*
* @description
* Specify custom behavior on copy event.
*
* @element window, input, select, textarea, a
* @priority 0
* @param {expression} ngCopy {@link guide/expression Expression} to evaluate upon
* copy. ({@link guide/expression#-event- Event object is available as `$event`})
*
@@ -445,12 +460,13 @@ forEach(
/**
* @ngdoc directive
* @name ngCut
* @restrict A
* @element window, input, select, textarea, a
* @priority 0
*
* @description
* Specify custom behavior on cut event.
*
* @element window, input, select, textarea, a
* @priority 0
* @param {expression} ngCut {@link guide/expression Expression} to evaluate upon
* cut. ({@link guide/expression#-event- Event object is available as `$event`})
*
@@ -466,12 +482,13 @@ forEach(
/**
* @ngdoc directive
* @name ngPaste
* @restrict A
* @element window, input, select, textarea, a
* @priority 0
*
* @description
* Specify custom behavior on paste event.
*
* @element window, input, select, textarea, a
* @priority 0
* @param {expression} ngPaste {@link guide/expression Expression} to evaluate upon
* paste. ({@link guide/expression#-event- Event object is available as `$event`})
*
+2 -3
View File
@@ -4,6 +4,8 @@
* @ngdoc directive
* @name ngInclude
* @restrict ECA
* @scope
* @priority -400
*
* @description
* Fetches, compiles and includes an external HTML fragment.
@@ -30,9 +32,6 @@
*
* The enter and leave animation occur concurrently.
*
* @scope
* @priority 400
*
* @param {string} ngInclude|src AngularJS expression evaluating to URL. If the source is a string constant,
* make sure you wrap it in **single** quotes, e.g. `src="'myPartialTemplate.html'"`.
* @param {string=} onload Expression to evaluate when a new partial is loaded.
+1
View File
@@ -4,6 +4,7 @@
* @ngdoc directive
* @name ngInit
* @restrict AC
* @priority 450
*
* @description
* The `ngInit` directive allows you to evaluate an expression in the
+9 -4
View File
@@ -4,6 +4,10 @@
/**
* @ngdoc directive
* @name ngList
* @restrict A
* @priority 100
*
* @param {string=} ngList optional delimiter that should be used to split the value.
*
* @description
* Text input that converts between a delimited string and an array of strings. The default
@@ -19,7 +23,8 @@
* when joining the list items back together) and whitespace around each list item is stripped
* before it is added to the model.
*
* ### Example with Validation
* @example
* ### Validation
*
* <example name="ngList-directive" module="listExample">
* <file name="app.js">
@@ -66,7 +71,9 @@
* </file>
* </example>
*
* ### Example - splitting on newline
* @example
* ### Splitting on newline
*
* <example name="ngList-directive-newlines">
* <file name="index.html">
* <textarea ng-model="list" ng-list="&#10;" ng-trim="false"></textarea>
@@ -82,8 +89,6 @@
* </file>
* </example>
*
* @element input
* @param {string=} ngList optional delimiter that should be used to split the value.
*/
var ngListDirective = function() {
return {
+6 -6
View File
@@ -27,7 +27,6 @@ var ngModelMinErr = minErr('ngModel');
/**
* @ngdoc type
* @name ngModel.NgModelController
*
* @property {*} $viewValue The actual value from the control's view. For `input` elements, this is a
* String. See {@link ngModel.NgModelController#$setViewValue} for information about when the $viewValue
* is set.
@@ -1092,9 +1091,9 @@ addSetValidityMethod({
/**
* @ngdoc directive
* @name ngModel
*
* @element input
* @restrict A
* @priority 1
* @param {expression} ngModel assignable {@link guide/expression Expression} to bind to.
*
* @description
* The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a
@@ -1171,8 +1170,7 @@ addSetValidityMethod({
*
* Keep in mind that ngAnimate can detect each of these classes when added and removed.
*
* ### Animation Hooks
*
* @animations
* Animations within models are triggered when any of the associated CSS classes are added and removed
* on the input element which is attached to the model. These classes include: `.ng-pristine`, `.ng-dirty`,
* `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself.
@@ -1196,6 +1194,7 @@ addSetValidityMethod({
* </pre>
*
* @example
* ### Basic Usage
* <example deps="angular-animate.js" animations="true" fixBase="true" module="inputExample" name="ng-model">
<file name="index.html">
<script>
@@ -1225,7 +1224,8 @@ addSetValidityMethod({
</file>
* </example>
*
* ## Binding to a getter/setter
* @example
* ### Binding to a getter/setter
*
* Sometimes it's helpful to bind `ngModel` to a getter/setter function. A getter/setter is a
* function that returns a representation of the model when called with zero arguments, and sets
+2
View File
@@ -92,6 +92,8 @@ defaultModelOptions = new ModelOptions({
/**
* @ngdoc directive
* @name ngModelOptions
* @restrict A
* @priority 10
*
* @description
* This directive allows you to modify the behaviour of {@link ngModel} directives within your
+3 -3
View File
@@ -13,7 +13,7 @@
* [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)
* and the strings to be displayed.
*
* # Plural categories and explicit number rules
* ## Plural categories and explicit number rules
* There are two
* [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)
* in AngularJS's default en-US locale: "one" and "other".
@@ -23,7 +23,7 @@
* explicit number rule for "3" matches the number 3. There are examples of plural categories
* and explicit number rules throughout the rest of this documentation.
*
* # Configuring ngPluralize
* ## Configuring ngPluralize
* You configure ngPluralize by providing 2 attributes: `count` and `when`.
* You can also provide an optional attribute, `offset`.
*
@@ -57,7 +57,7 @@
* If no rule is defined for a category, then an empty string is displayed and a warning is generated.
* Note that some locales define more categories than `one` and `other`. For example, fr-fr defines `few` and `many`.
*
* # Configuring ngPluralize with offset
* ## Configuring ngPluralize with offset
* The `offset` attribute allows further customization of pluralized text, which can result in
* a better user experience. For example, instead of the message "4 people are viewing this document",
* you might display "John, Kate and 2 others are viewing this document".
+10 -15
View File
@@ -60,7 +60,11 @@ var NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';
* By default you don't need to override anything in CSS and the animations will work around the
* display style.
*
* ## A note about animations with `ngShow`
* @animations
* | Animation | Occurs |
* |-----------------------------------------------------|---------------------------------------------------------------------------------------------------------------|
* | {@link $animate#addClass addClass} `.ng-hide` | After the `ngShow` expression evaluates to a non truthy value and just before the contents are set to hidden. |
* | {@link $animate#removeClass removeClass} `.ng-hide` | After the `ngShow` expression evaluates to a truthy value and just before contents are set to visible. |
*
* Animations in `ngShow`/`ngHide` work with the show and hide events that are triggered when the
* directive expression is true and false. This system works like the animation system present with
@@ -82,12 +86,6 @@ var NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';
* Keep in mind that, as of AngularJS version 1.3, there is no need to change the display property
* to block during animation states - ngAnimate will automatically handle the style toggling for you.
*
* @animations
* | Animation | Occurs |
* |-----------------------------------------------------|---------------------------------------------------------------------------------------------------------------|
* | {@link $animate#addClass addClass} `.ng-hide` | After the `ngShow` expression evaluates to a non truthy value and just before the contents are set to hidden. |
* | {@link $animate#removeClass removeClass} `.ng-hide` | After the `ngShow` expression evaluates to a truthy value and just before contents are set to visible. |
*
* @element ANY
* @param {expression} ngShow If the {@link guide/expression expression} is truthy/falsy then the
* element is shown/hidden respectively.
@@ -262,7 +260,11 @@ var ngShowDirective = ['$animate', function($animate) {
* By default you don't need to override in CSS anything and the animations will work around the
* display style.
*
* ## A note about animations with `ngHide`
* @animations
* | Animation | Occurs |
* |-----------------------------------------------------|------------------------------------------------------------------------------------------------------------|
* | {@link $animate#addClass addClass} `.ng-hide` | After the `ngHide` expression evaluates to a truthy value and just before the contents are set to hidden. |
* | {@link $animate#removeClass removeClass} `.ng-hide` | After the `ngHide` expression evaluates to a non truthy value and just before contents are set to visible. |
*
* Animations in `ngShow`/`ngHide` work with the show and hide events that are triggered when the
* directive expression is true and false. This system works like the animation system present with
@@ -284,13 +286,6 @@ var ngShowDirective = ['$animate', function($animate) {
* Keep in mind that, as of AngularJS version 1.3, there is no need to change the display property
* to block during animation states - ngAnimate will automatically handle the style toggling for you.
*
* @animations
* | Animation | Occurs |
* |-----------------------------------------------------|------------------------------------------------------------------------------------------------------------|
* | {@link $animate#addClass addClass} `.ng-hide` | After the `ngHide` expression evaluates to a truthy value and just before the contents are set to hidden. |
* | {@link $animate#removeClass removeClass} `.ng-hide` | After the `ngHide` expression evaluates to a non truthy value and just before contents are set to visible. |
*
*
* @element ANY
* @param {expression} ngHide If the {@link guide/expression expression} is truthy/falsy then the
* element is hidden/shown respectively.
+19
View File
@@ -4,6 +4,10 @@
* @name ngRequired
* @restrict A
*
* @param {expression} ngRequired AngularJS expression. If it evaluates to `true`, it sets the
* `required` attribute to the element and adds the `required`
* {@link ngModel.NgModelController#$validators `validator`}.
*
* @description
*
* ngRequired adds the required {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
@@ -80,6 +84,11 @@ var requiredDirective = function() {
/**
* @ngdoc directive
* @name ngPattern
* @restrict A
*
* @param {expression|RegExp} ngPattern AngularJS expression that must evaluate to a `RegExp` or a `String`
* parsable into a `RegExp`, or a `RegExp` literal. See above for
* more details.
*
* @description
*
@@ -186,6 +195,11 @@ var patternDirective = function() {
/**
* @ngdoc directive
* @name ngMaxlength
* @restrict A
*
* @param {expression} ngMaxlength AngularJS expression that must evaluate to a `Number` or `String`
* parsable into a `Number`. Used as value for the `maxlength`
* {@link ngModel.NgModelController#$validators validator}.
*
* @description
*
@@ -272,6 +286,11 @@ var maxlengthDirective = function() {
/**
* @ngdoc directive
* @name ngMinlength
* @restrict A
*
* @param {expression} ngMinlength AngularJS expression that must evaluate to a `Number` or `String`
* parsable into a `Number`. Used as value for the `minlength`
* {@link ngModel.NgModelController#$validators validator}.
*
* @description
*
+6
View File
@@ -53,6 +53,12 @@ function $TemplateRequestProvider() {
* If you want to pass custom options to the `$http` service, such as setting the Accept header you
* can configure this via {@link $templateRequestProvider#httpOptions}.
*
* `$templateRequest` is used internally by {@link $compile}, {@link ngRoute.$route}, and directives such
* as {@link ngInclude} to download and cache templates.
*
* 3rd party modules should use `$templateRequest` if their services or directives are loading
* templates.
*
* @param {string|TrustedResourceUrl} tpl The HTTP request template URL
* @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty
*
+1 -1
View File
@@ -26,7 +26,7 @@
* | {@link ng.directive:ngIf#animations ngIf} | enter and leave |
* | {@link ng.directive:ngClass#animations ngClass} | add and remove (the CSS class(es) present) |
* | {@link ng.directive:ngShow#animations ngShow} & {@link ng.directive:ngHide#animations ngHide} | add and remove (the ng-hide class value) |
* | {@link ng.directive:form#animation-hooks form} & {@link ng.directive:ngModel#animation-hooks ngModel} | add and remove (dirty, pristine, valid, invalid & all other validations) |
* | {@link ng.directive:form#animations form} & {@link ng.directive:ngModel#animations ngModel} | add and remove (dirty, pristine, valid, invalid & all other validations) |
* | {@link module:ngMessages#animations ngMessages} | add and remove (ng-active & ng-inactive) |
* | {@link module:ngMessages#animations ngMessage} | enter and leave |
*
+1
View File
@@ -592,6 +592,7 @@ angular.module('ngMessages', [], function initAngularHelpers() {
* @name ngMessage
* @restrict AE
* @scope
* @priority 1
*
* @description
* `ngMessage` is a directive with the purpose to show and hide a particular message.
+4 -4
View File
@@ -291,7 +291,7 @@ function shallowClearAndCopy(src, dst) {
*
* @example
*
* # Credit card resource
* ### Credit card resource
*
* ```js
// Define CreditCard class
@@ -336,7 +336,7 @@ function shallowClearAndCopy(src, dst) {
*
* @example
*
* # User resource
* ### User resource
*
* When the data is returned from the server then the object is an instance of the resource type and
* all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD
@@ -377,7 +377,7 @@ function shallowClearAndCopy(src, dst) {
*
* @example
*
* # Creating a custom 'PUT' request
* ### Creating a custom 'PUT' request
*
* In this example we create a custom method on our resource to make a PUT request
* ```js
@@ -409,7 +409,7 @@ function shallowClearAndCopy(src, dst) {
*
* @example
*
* # Cancelling requests
* ### Cancelling requests
*
* If an action's configuration specifies that it is cancellable, you can cancel the request related
* to an instance or collection (as long as it is a result of a "non-instance" call):