You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 4, 2017. It is now read-only.
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.
27
27
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.
30
30
That object is usually the Angular component that controls the template ... which it definitely is
31
31
in this case because that snippet of HTML belongs to the following component:
32
32
@@ -112,8 +112,8 @@ figure.image-display
112
112
Angular only updates the bindings (and therefore the screen)
113
113
if we do something in response to asynchronous events such as keystrokes.
114
114
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.
117
117
That is all it takes to keep Angular happy. We said it would be clever!
118
118
:marked
119
119
That local template variable is intriguing. It's clearly easier to get to the textbox with that
@@ -131,14 +131,14 @@ figure.image-display
131
131
## Key event filtering (with `key.enter`)
132
132
Perhaps we don't care about every keystroke.
133
133
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*.
135
135
We could filter the keys first, examining every `$event.keyCode`, and update the `values` property only if the key is Enter.
136
136
137
137
Angular can filter the key events for us. Angular has a special syntax for keyboard events.
138
138
We can listen for just the Enter key by binding to Angular's `keyup.enter` pseudo-event.
139
139
140
140
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
142
142
would be to put the update code in the component.)
0 commit comments