Skip to content

Commit f555332

Browse files
authored
Merge pull request ember-learn#702 from zachgarwood/angle-bracket-ize--tutorial--autocomplete-component
Angle-bracket-ize tutorial/autocomplete-component.md
2 parents 1749315 + 4eca774 commit f555332

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

guides/release/tutorial/autocomplete-component.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,12 @@ In this case we are passing, or "yielding", our filter data to the inner markup
3131
<p>
3232
We hope you find exactly what you're looking for in a place to stay.
3333
</p>
34-
{{#link-to "about" class="button"}}
34+
<LinkTo @route="about" class="button">
3535
About Us
36-
{{/link-to}}
36+
</LinkTo>
3737
</div>
3838
39-
<ListFilter
40-
@filter={{action "filterByCity"}}
41-
as |filteredResults|
42-
>
39+
<ListFilter @filter={{action "filterByCity"}} as |filteredResults|>
4340
<ul class="results">
4441
{{#each filteredResults as |rentalUnit|}}
4542
<li><RentalListing @rental={{rentalUnit}} /></li>
@@ -57,21 +54,25 @@ as |filteredResults|
5754
We want the component to simply provide an input field and yield the results list to its block, so our template will be simple:
5855

5956
```handlebars {data-filename=app/templates/components/list-filter.hbs}
60-
{{input
61-
value=this.value
62-
key-up=(action "handleFilterEntry")
57+
<Input
58+
@value=this.value
59+
@key-up=(action "handleFilterEntry")
6360
class="light"
6461
placeholder="Filter By City"
65-
}}
62+
/>
6663
{{yield this.results}}
6764
```
6865

69-
The template contains an [`{{input}}`](../../templates/input-helpers/) helper that renders as a text field, in which the user can type a pattern to filter the list of cities used in a search.
70-
The `value` property of the `input` will be kept in sync with the `value` property in the component.
66+
The template contains an [`<Input />`](../../templates/input-helpers/) helper
67+
that renders as a text field, in which the user can type a pattern to filter the
68+
list of cities used in a search. The `@value` argument of the `<Input />` will
69+
be kept in sync with the `value` property in the component.
7170

72-
Another way to say this is that the `value` property of `input` is [**bound**](../../object-model/bindings/) to the `value` property of the component.
73-
If the property changes, either by the user typing in the input field, or by assigning a new value to it in our program,
74-
the new value of the property is present in both the rendered web page and in the code.
71+
Another way to say this is that the `@value` argument of `<Input />` is
72+
[**bound**](../../object-model/bindings/) to the `value` property of the
73+
component. If the property changes, either by the user typing in the input
74+
field, or by assigning a new value to it in our program, the new value of the
75+
property is present in both the rendered web page and in the code.
7576

7677
The `key-up` property will be bound to the `handleFilterEntry` action.
7778

@@ -102,7 +103,7 @@ export default class ListFilterComponent extends Component {
102103

103104
#### Filtering Data Based on Input
104105

105-
In the above example we use the `init` hook to seed our initial listings by calling the `filter` action with an empty value.
106+
In the above example we use the `constructor` to seed our initial listings by calling the `filter` action with an empty value.
106107
Our `handleFilterEntry` action calls a function called `filter` based on the `value` attribute set by the input helper.
107108

108109
The `filter` function is passed in by the calling object. This is a pattern known as closure actions.

0 commit comments

Comments
 (0)