From b561fb2d138dc808b6c7eabd4d4a6d3a3dc61701 Mon Sep 17 00:00:00 2001 From: Trotyl Yu Date: Sat, 5 Sep 2015 00:22:02 +0800 Subject: [PATCH 01/11] According to dictionary 'syntax' is countable and according to context it should be plural. --- modules/angular2/docs/core/01_templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/angular2/docs/core/01_templates.md b/modules/angular2/docs/core/01_templates.md index ebbf0d2ab3b1..daec64b9b8c7 100644 --- a/modules/angular2/docs/core/01_templates.md +++ b/modules/angular2/docs/core/01_templates.md @@ -2,7 +2,7 @@ Templates are markup which is added to HTML to declaratively describe how the application model should be projected to DOM as well as which DOM events should invoke which methods on the controller. Templates contain -syntax which is core to Angular and allows for data-binding, event-binding, template-instantiation. +syntaxes which are core to Angular and allows for data-binding, event-binding, template-instantiation. The design of the template syntax has these properties: From 184a1c4cdbbcbb9e91c028dd6189d9537ce92b5b Mon Sep 17 00:00:00 2001 From: Trotyl Yu Date: Sat, 5 Sep 2015 01:04:24 +0800 Subject: [PATCH 02/11] fix the broken table of template summary. --- modules/angular2/docs/core/01_templates.md | 152 +++++++++++---------- 1 file changed, 78 insertions(+), 74 deletions(-) diff --git a/modules/angular2/docs/core/01_templates.md b/modules/angular2/docs/core/01_templates.md index daec64b9b8c7..3b25f2c94856 100644 --- a/modules/angular2/docs/core/01_templates.md +++ b/modules/angular2/docs/core/01_templates.md @@ -35,34 +35,30 @@ detail in the following sections. Text Interpolation
-```
-
{{exp}}
-``` +<div>{{exp}}</div>
Example:
-```
-
+<div> Hello {{name}}! -
+ <br> Goodbye {{name}}! -
-``` +</div>
-`
` +
+<div [text|index]="exp"></div>
+
Example:
-```
-
- _x_ -
-``` + [text|2]=" 'Goodbye' + stringify(name) + '!' "> + <b>x</b> +</div>
@@ -70,148 +66,156 @@ Example: Property Interpolation
-```
-
-``` +<div name="{{exp}}"></div>
Example:
-```
-
` -``` +<div class="{{selected}}"></div>
-```
-
-``` +<div [name]="stringify(exp)"></div>
Example:
-```
-
-``` +<div [title]="stringify(selected)"></div>
Property binding -`
` +
+<div [prop]="exp"></div>
+
Example: -`
` +
+<div [hidden]="true"></div>
+
-`
` +
+<div bind-prop="exp"></div>
+
Example: -`
` +
+<div bind-hidden="true"></div>
+
Event binding (non-bubbling) -`
` +
+<div (event)="statement"></div>
+
Example: -`
` +
+<div (click)="doX()"></div>
+
-`
` +
+<div on-event="statement"></div>
+
Example:
-```
-
+ +Or: + +
+<div def="symbol"></div>
 
- - -`
` Example:
-```
-
Inline Template -`
...
` +
+<div template="...">...</div>
+
Example:
-```
-
    -
  • +<ul> + <li template="for: #item of items"> {{item}} -
  • -
-``` + </li> +</ul>
-`` +
+<template>...</template>
+
Example:
-```
-
    - -
-``` + </li> + </template> +</ul>
Explicit Template -`` +
+<template>...</template>
+
Example:
-```
-
-```
+</template>
 
-`` +
+<template>...</template>
+
Example: +
-```
-
-```
+</template>
 
From 6ca5a45e3c20efc7c69cebcdad6ef6a41e7dcb3c Mon Sep 17 00:00:00 2001 From: Trotyl Yu Date: Sat, 5 Sep 2015 01:07:56 +0800 Subject: [PATCH 03/11] fix the table in Property Binding. --- modules/angular2/docs/core/01_templates.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/angular2/docs/core/01_templates.md b/modules/angular2/docs/core/01_templates.md index 3b25f2c94856..1d25d820c30f 100644 --- a/modules/angular2/docs/core/01_templates.md +++ b/modules/angular2/docs/core/01_templates.md @@ -232,11 +232,11 @@ are always in the form of `property-name` which is assigned an `expression`. The - + - +
Short form``
<some-element [some-property]="expression">
Canonical form``
<some-element bind-some-property="expression">
From 590b2a41e7f6e6109d491446f885b0cda7c445e9 Mon Sep 17 00:00:00 2001 From: Trotyl Yu Date: Sat, 5 Sep 2015 01:10:10 +0800 Subject: [PATCH 04/11] fix a position of right parethesis in Property Binding. --- modules/angular2/docs/core/01_templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/angular2/docs/core/01_templates.md b/modules/angular2/docs/core/01_templates.md index 1d25d820c30f..7504a71573ff 100644 --- a/modules/angular2/docs/core/01_templates.md +++ b/modules/angular2/docs/core/01_templates.md @@ -259,7 +259,7 @@ Key points: * The binding is to the element property not the element attribute. * To prevent custom element from accidentally reading the literal `expression` on the title element, the attribute name is escaped. In our case the `title` is escaped to `[title]` through the addition of square brackets `[]`. -* A binding value (in this case `user.firstName` will always be an expression, never a string literal). +* A binding value (in this case `user.firstName`) will always be an expression, never a string literal. NOTE: Unlike Angular v1, Angular v2 binds to properties of elements rather than attributes of elements. This is done to better support custom elements, and to allow binding for values other than strings. From 38508d3cbfd5844220b2b992e8ed8784c46b0068 Mon Sep 17 00:00:00 2001 From: Trotyl Yu Date: Sat, 5 Sep 2015 01:13:04 +0800 Subject: [PATCH 05/11] fix a occurance of a non-sense underscore. --- modules/angular2/docs/core/01_templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/angular2/docs/core/01_templates.md b/modules/angular2/docs/core/01_templates.md index 7504a71573ff..086a8ad60e69 100644 --- a/modules/angular2/docs/core/01_templates.md +++ b/modules/angular2/docs/core/01_templates.md @@ -281,7 +281,7 @@ syntax which is just a short hand for the data binding syntax. is a short hand for: ``` -_ + ``` The above says to bind the `'Hello ' + stringify(name) + '!'` expression to the zero-th child of the `span`'s `text` From 17c4867581c53bbc46c86c21897944e3105fe561 Mon Sep 17 00:00:00 2001 From: Trotyl Yu Date: Sat, 5 Sep 2015 01:19:36 +0800 Subject: [PATCH 06/11] fix a table in Inline Templates. --- modules/angular2/docs/core/01_templates.md | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/angular2/docs/core/01_templates.md b/modules/angular2/docs/core/01_templates.md index 086a8ad60e69..d99a85aaf6e4 100644 --- a/modules/angular2/docs/core/01_templates.md +++ b/modules/angular2/docs/core/01_templates.md @@ -321,25 +321,25 @@ Views than can be inserted and removed as needed to change the DOM structure. Short form -``` +
 parent template
-
-  child template
-
-```
+<element>
+  <some-element template="instantiating-directive-microsyntax">child template</some-element>
+</element>
+
Canonical form -``` +
 parent template
-
-  
-
-```
+<element>
+  <template instantiating-directive-bindings>
+    <some-element>child template</some-element>
+  </template>
+</element>
+
From c1b8b7decc74323e5319046eabb5f67eec0d8145 Mon Sep 17 00:00:00 2001 From: Trotyl Yu Date: Sat, 5 Sep 2015 01:22:23 +0800 Subject: [PATCH 07/11] fix a missing '.' in Template Microsyntax. --- modules/angular2/docs/core/01_templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/angular2/docs/core/01_templates.md b/modules/angular2/docs/core/01_templates.md index d99a85aaf6e4..bdd5b0f924e4 100644 --- a/modules/angular2/docs/core/01_templates.md +++ b/modules/angular2/docs/core/01_templates.md @@ -452,7 +452,7 @@ microsyntax: ([[key|keyExpression|varExport][;|,]?)* ``` Where -* `expression` is an Angular expression as defined in section: Expressions +* `expression` is an Angular expression as defined in section: Expressions. * `local` is a local identifier for local variables. * `internal` is an internal variable which the directive exports for binding. * `key` is an attribute name usually only used to trigger a specific directive. From 1ec64bd20f5e8290f4f343e4b55d7cfbf1a31ba6 Mon Sep 17 00:00:00 2001 From: Trotyl Yu Date: Sat, 5 Sep 2015 01:26:40 +0800 Subject: [PATCH 08/11] fix the table in '## Binding Events'. --- modules/angular2/docs/core/01_templates.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/angular2/docs/core/01_templates.md b/modules/angular2/docs/core/01_templates.md index bdd5b0f924e4..9d283fb1bf7a 100644 --- a/modules/angular2/docs/core/01_templates.md +++ b/modules/angular2/docs/core/01_templates.md @@ -477,11 +477,11 @@ Binding events allows wiring events from DOM (or other components) to the Angula - + - +
Short form``
<some-element (some-event)="statement">
Canonical form``
<some-element on-some-event="statement">
@@ -497,11 +497,11 @@ Angular listens to bubbled DOM events (as in the case of clicking on any child), - + - +
Short form``
<some-element (some-event)="statement">
Canonical form``
<some-element on-some-event="statement">
From 927044256ce10d93490f39b766964281ce8c0f9e Mon Sep 17 00:00:00 2001 From: Trotyl Yu Date: Sat, 5 Sep 2015 01:28:06 +0800 Subject: [PATCH 09/11] fix an article usage of 'an' against 'a' in '## Binding Events'. --- modules/angular2/docs/core/01_templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/angular2/docs/core/01_templates.md b/modules/angular2/docs/core/01_templates.md index 9d283fb1bf7a..1f09bf151355 100644 --- a/modules/angular2/docs/core/01_templates.md +++ b/modules/angular2/docs/core/01_templates.md @@ -523,7 +523,7 @@ component's controller. NOTE: Unlike Angular v1, Angular v2 treats event bindings as core constructs not as directives. This means that there -is no need to create a event directive for each kind of event. This makes it possible for Angular v2 to easily +is no need to create an event directive for each kind of event. This makes it possible for Angular v2 to easily bind to custom events of Custom Elements, whose event names are not known ahead of time. From 1d62e07303ba34f5c25f682b5cb81bfc4398b92e Mon Sep 17 00:00:00 2001 From: Trotyl Yu Date: Sat, 5 Sep 2015 01:30:21 +0800 Subject: [PATCH 10/11] fix a statement against the usage of plural after 'any'. --- modules/angular2/docs/core/01_templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/angular2/docs/core/01_templates.md b/modules/angular2/docs/core/01_templates.md index 1f09bf151355..19534d69b548 100644 --- a/modules/angular2/docs/core/01_templates.md +++ b/modules/angular2/docs/core/01_templates.md @@ -538,7 +538,7 @@ have different semantics. ### Expressions Expressions can be used to bind to properties only. Expressions represent how data should be projected to the View. -Expressions should not have any side effects and should be idempotent. Examples of where expressions can be used in +Expressions should not have any side effect and should be idempotent. Examples of where expressions can be used in Angular are: ```
{{expression}}
From d433f0d6909ba2dc0a5c0febb4e79bdbe33ea15e Mon Sep 17 00:00:00 2001 From: Trotyl Yu Date: Sat, 5 Sep 2015 01:41:21 +0800 Subject: [PATCH 11/11] fix the typo error in former fixes. --- modules/angular2/docs/core/01_templates.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/angular2/docs/core/01_templates.md b/modules/angular2/docs/core/01_templates.md index 19534d69b548..e152763f43e0 100644 --- a/modules/angular2/docs/core/01_templates.md +++ b/modules/angular2/docs/core/01_templates.md @@ -232,11 +232,11 @@ are always in the form of `property-name` which is assigned an `expression`. The - + - +
Short form
<some-element [some-property]="expression">
<some-element [some-property]="expression">
Canonical form
<some-element bind-some-property="expression">
<some-element bind-some-property="expression">