Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit b24c813

Browse files
committed
docs(user-input): replace "expression" w/ "statement" in TS doc
closes #714
1 parent 693c5e6 commit b24c813

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

public/docs/ts/latest/guide/user-input.jade

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ include ../../../../_includes/_util-fns
1414
We can use [Angular event bindings](./template-syntax.html#event-binding)
1515
to respond to [any DOM event](https://developer.mozilla.org/en-US/docs/Web/Events).
1616

17-
The syntax is simple. We assign a template expression to the DOM event name, surrounded in parentheses.
17+
The syntax is simple. We surround the DOM event name in parentheses and assign a quoted template statement to it.
1818
As an example, here's an event binding that implements a click handler:
1919
+makeExample('user-input/ts/app/click-me.component.ts', 'click-me-button')(format=".", language="html")
2020

2121
<a id="click"></a>
2222
:marked
2323
The `(click)` to the left of the equal sign identifies the button's click event as the **target of the binding**.
24-
The text within quotes on the right is the **template expression** in which we
25-
respond to the click event by calling the component's `onClickMe` method. A [template expression](./template-syntax.html#template-expressions) is a subset
26-
of JavaScript with a few added tricks.
24+
The text within quotes on the right is the **template statement** in which we
25+
respond to the click event by calling the component's `onClickMe` method. A [template statement](./template-syntax.html#template-statements) is a subset
26+
of JavaScript with restrictions and a few added tricks.
2727

28-
When writing a binding we must be aware of a template expression's **execution context**.
29-
The identifiers appearing within an expression belong to a specific context object.
28+
When writing a binding we must be aware of a template statement's **execution context**.
29+
The identifiers appearing within an statement belong to a specific context object.
3030
That object is usually the Angular component that controls the template ... which it definitely is
3131
in this case because that snippet of HTML belongs to the following component:
3232

@@ -112,8 +112,8 @@ figure.image-display
112112
Angular only updates the bindings (and therefore the screen)
113113
if we do something in response to asynchronous events such as keystrokes.
114114

115-
That's why we bind the `keyup` event to an expression that does ... well, nothing.
116-
We're binding to the number 0, the shortest expression we can think of.
115+
That's why we bind the `keyup` event to an statement that does ... well, nothing.
116+
We're binding to the number 0, the shortest statement we can think of.
117117
That is all it takes to keep Angular happy. We said it would be clever!
118118
:marked
119119
That local template variable is intriguing. It's clearly easier to get to the textbox with that
@@ -131,14 +131,14 @@ figure.image-display
131131
## Key event filtering (with `key.enter`)
132132
Perhaps we don't care about every keystroke.
133133
Maybe we're only interested in the input box value when the user presses Enter, and we'd like to ignore all other keys.
134-
When we bind to the `(keyup)` event, our event handling expression hears *every keystroke*.
134+
When we bind to the `(keyup)` event, our event handling statement hears *every keystroke*.
135135
We could filter the keys first, examining every `$event.keyCode`, and update the `values` property only if the key is Enter.
136136

137137
Angular can filter the key events for us. Angular has a special syntax for keyboard events.
138138
We can listen for just the Enter key by binding to Angular's `keyup.enter` pseudo-event.
139139

140140
Only then do we update the component's `values` property. (In this example,
141-
the update happens inside the event expression. A better practice
141+
the update happens inside the event binding statement. A better practice
142142
would be to put the update code in the component.)
143143
+makeExample('user-input/ts/app/keyup.components.ts', 'key-up-component-3' ,'app/keyup.components.ts (v3)')(format=".")
144144
:marked
@@ -198,7 +198,7 @@ figure.image-display
198198
Instead, we grab the input box *value* and pass *that* to `addHero`.
199199
The component knows nothing about HTML or the DOM, which is the way we like it.
200200

201-
### Keep template expressions simple
201+
### Keep template statements simple
202202
We bound `(blur)` to *two* JavaScript statements.
203203

204204
We like the first one, which calls `addHero`.
@@ -209,7 +209,7 @@ figure.image-display
209209
input box (our design choice).
210210

211211
Although the example *works*, we are rightly wary of JavaScript in HTML.
212-
Template expressions are powerful. We're supposed to use them responsibly.
212+
Template statements are powerful. We're supposed to use them responsibly.
213213
Complex JavaScript in HTML is irresponsible.
214214

215215
Should we reconsider our reluctance to pass the input box into the component?

0 commit comments

Comments
 (0)