Skip to content

Commit 86211eb

Browse files
vicbmhevery
authored andcommitted
doc(directives): add inline documentation
Closes angular#1240
1 parent a3387b7 commit 86211eb

File tree

4 files changed

+64
-1
lines changed

4 files changed

+64
-1
lines changed

modules/angular2/src/directives/for.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,35 @@ import {isPresent, isBlank} from 'angular2/src/facade/lang';
55
import {ListWrapper} from 'angular2/src/facade/collection';
66

77
/**
8+
* The `For` directive instantiates a template once per item from an iterable. The context for each
9+
* instantiated template inherits from the outer context with the given loop variable set to the
10+
* current item from the iterable.
11+
*
12+
* It is possible to alias the `index` to a local variable that will be set to the current loop
13+
* iteration in the template context.
14+
*
15+
* When the contents of the iterator changes, `For` makes the corresponding changes to the DOM:
16+
*
17+
* * When an item is added, a new instance of the template is added to the DOM.
18+
* * When an item is removed, its template instance is removed from the DOM.
19+
* * When items are reordered, their respective templates are reordered in the DOM.
20+
*
21+
* # Example
22+
*
23+
* ```
24+
* <ul>
25+
* <li *for="error in errors; #i = index">
26+
* Error {{i}} of {{errors.length}}: {{error.message}}
27+
* </li>
28+
* </ul>
29+
* ```
30+
*
31+
* # Syntax
32+
*
33+
* - `<li *for="#item of items; #i = index">...</li>`
34+
* - `<li template="for #item of items; #i=index">...</li>`
35+
* - `<template [for]="#item" [of]="items" #i="index"><li>...</li></template>`
36+
*
837
* @publicModule angular2/directives
938
*/
1039
@Viewport({

modules/angular2/src/directives/if.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@ import {ViewContainer} from 'angular2/src/core/compiler/view_container';
33
import {isBlank} from 'angular2/src/facade/lang';
44

55
/**
6+
* The `If` directive removes or recreates a portion of the DOM tree based on an {expression}. If
7+
* the expression assigned to `if` evaluates to a false value then the element is removed from the
8+
* DOM, otherwise a clone of the element is reinserted into the DOM.
9+
*
10+
* # Example:
11+
*
12+
* ```
13+
* <div *if="errorCount > 0" class="error">
14+
* <!-- Error message displayed when the errorCount property on the current context is greater than 0. -->
15+
* {{errorCount}} errors detected
16+
* </div>
17+
* ```
18+
*
19+
* # Syntax
20+
*
21+
* - `<div *if="condition">...</div>`
22+
* - `<div template="if condition">...</div>`
23+
* - `<template [if]="condition"><div>...</div></template>`
24+
*
625
* @publicModule angular2/directives
726
*/
827
@Viewport({

modules/angular2/src/directives/non_bindable.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
import {Decorator} from 'angular2/src/core/annotations/annotations';
22

33
/**
4+
* The `NonBindable` directive tells Angular not to compile or bind the contents of the current
5+
* DOM element. This is useful if the element contains what appears to be Angular directives and
6+
* bindings but which should be ignored by Angular. This could be the case if you have a site that
7+
* displays snippets of code, for instance.
8+
*
9+
* Example:
10+
*
11+
* ```
12+
* <div>Normal: {{1 + 2}}</div> // output "Normal: 3"
13+
* <div non-bindable>Ignored: {{1 + 2}}</div> // output "Ignored: {{1 + 2}}"
14+
* ```
15+
*
416
* @publicModule angular2/directives
517
*/
618
@Decorator({

modules/angular2/src/directives/switch.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {Parent} from 'angular2/src/core/annotations/visibility';
2020
* evaluated. If a matching expression is not found via a when attribute then an element with the
2121
* default attribute is displayed.
2222
*
23-
* Example:
23+
* # Example:
2424
*
2525
* ```
2626
* <ANY [switch]="expression">
@@ -29,6 +29,7 @@ import {Parent} from 'angular2/src/core/annotations/visibility';
2929
* <template [switch-default]>...</template>
3030
* </ANY>
3131
* ```
32+
*
3233
* @publicModule angular2/directives
3334
*/
3435
@Decorator({
@@ -181,6 +182,8 @@ export class SwitchWhen {
181182
*
182183
* @publicModule angular2/directives
183184
* ```
185+
*
186+
* @publicModule angular2/directives
184187
*/
185188
@Viewport({
186189
selector: '[switch-default]'

0 commit comments

Comments
 (0)