Skip to content

Commit 60c2a62

Browse files
authored
Merge pull request ember-learn#797 from ember-learn/linkto-and-input
Finish converting link-to and input to angle brackets
2 parents 83beb0c + 43bb9e9 commit 60c2a62

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

guides/release/routing/redirection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Ember allows you to control that access with a combination of hooks and methods
1010
One of the methods is [`transitionTo()`](https://www.emberjs.com/api/ember/release/classes/Route/methods/transitionTo?anchor=transitionTo).
1111
Calling `transitionTo()` from a route or
1212
[`transitionToRoute()`](https://www.emberjs.com/api/ember/release/classes/Controller/methods/transitionToRoute?anchor=transitionToRoute) from a controller will stop any transitions currently in progress and start a new one, functioning as a redirect.
13-
`transitionTo()` behaves exactly like the [link-to](../../templates/links/) helper.
13+
`transitionTo()` behaves exactly like the [`LinkTo`](../../templates/links/) helper.
1414

1515
The other one is [`replaceWith()`](https://www.emberjs.com/api/ember/release/classes/Route/methods/transitionTo?anchor=replaceWith/) which works the same way as `transitionTo()`.
1616
The only difference between them is how they manage history.

guides/release/templates/input-helpers.md

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
The [`{{input}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=input)
2-
and [`{{textarea}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=textarea)
1+
The [`Input`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=input)
2+
and [`Textarea`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=textarea)
33
helpers in Ember.js are the easiest way to create common form controls.
44
Using these helpers, you can create form controls that are almost identical to the native HTML `<input>` or `<textarea>` elements, but are aware of Ember's two-way bindings and can automatically update.
55

66
## Text fields
77

88
```handlebars
9-
{{input value="http://www.facebook.com"}}
9+
<label for="site">Site URL</label>
10+
<Input value="http://www.facebook.com" id="site" />
1011
```
1112

1213
Will become:
1314

1415
```html
15-
<input type="text" value="http://www.facebook.com"/>
16+
<label for="site">Site URL</label>
17+
<input type="text" value="http://www.facebook.com" id="site"/>
1618
```
1719

1820
You can pass the following standard `<input>` attributes within the input
@@ -37,7 +39,8 @@ unquoted, these values will be bound to a property on the template's current
3739
rendering context. For example:
3840

3941
```handlebars
40-
{{input type="text" value=this.firstName disabled=this.entryNotAllowed size="50"}}
42+
<label for="firstname">First Name</label>
43+
<input type="text" value={{this.firstName}} disabled={{this.entryNotAllowed}} size="50" id="firstname" />
4144
```
4245

4346
Will bind the `disabled` attribute to the value of `entryNotAllowed` in the
@@ -48,7 +51,8 @@ current context.
4851
To dispatch an action on specific events such as `key-press`, use the following
4952

5053
```handlebars
51-
{{input value=this.firstName key-press=(action "updateFirstName")}}
54+
<label for="firstname">First Name</label>
55+
<Input @value={{this.firstName}} @key-press={{action "updateFirstName" id="firstname"}} />
5256
```
5357

5458
The following event types are supported (dasherized format):
@@ -67,11 +71,12 @@ More [events types](https://www.emberjs.com/api/ember/release/classes/Component)
6771
## Checkboxes
6872

6973
You can also use the
70-
[`{{input}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=input)
74+
[`Input`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=input)
7175
helper to create a checkbox by setting its `type`:
7276

7377
```handlebars
74-
{{input type="checkbox" name="isAdmin" checked=this.isAdmin}}
78+
<label for="is-admin">Admin: </label>
79+
<Input @type="checkbox" @name="isAdmin" @checked={{this.isAdmin}} id="is-admin"/>
7580
```
7681

7782
Checkboxes support the following properties:
@@ -91,19 +96,21 @@ Which can be bound or set as described in the previous section.
9196
Checkboxes are a special input type. If you want to dispatch an action on a certain [event](https://www.emberjs.com/api/ember/release/classes/Component), you will always need to define the event name in camelCase format:
9297

9398
```handlebars
94-
{{input type="checkbox" keyPress=(action "updateName")}}
99+
<label for="firstname">First Name</label>
100+
<Input @type="checkbox" @key-press={{action "updateName"}} id="firstname" />
95101
```
96102

97103

98104
## Text Areas
99105

100106
```handlebars
101-
{{textarea value=this.name cols="80" rows="6"}}
107+
<label for="firstname">First Name</label>
108+
<Textarea @value={{this.name}} cols="80" rows="6" id="firstname" />
102109
```
103110

104111
Will bind the value of the text area to `name` on the current context.
105112

106-
[`{{textarea}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/textarea?anchor=textarea) supports binding and/or setting the following properties:
113+
[`Textarea`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/textarea?anchor=textarea) supports binding and/or setting the following properties:
107114

108115
* `value`
109116
* `name`
@@ -128,7 +135,8 @@ Will bind the value of the text area to `name` on the current context.
128135
You might need to bind a property dynamically to an input if you're building a flexible form, for example. To achieve this you need to use the [`{{get}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/get?anchor=get) and [`{{mut}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/mut?anchor=mut) in conjunction like shown in the following example:
129136

130137
```handlebars
131-
{{input value=(mut (get this.person this.field))}}
138+
<label for="firstname">First Name</label>
139+
<Input @value={{mut (get this.person this.field)}} id="firstname" />
132140
```
133141

134142
The `{{get}}` helper allows you to dynamically specify which property to bind, while the `{{mut}}` helper allows the binding to be updated from the input. See the respective helper documentation for more detail.

0 commit comments

Comments
 (0)