Ember provides 2 components for building a form :
* <Input>
* <Textarea>
These components are similar in HTML markup to the native <input>
or <textarea>
elements. In contrast to the native elements, <Input>
and <Textarea>
automatically update the state of their bound values.
<Input>
: We mentioned that the built-in components are similar in HTML markup to their native counterparts.
Consider the following example in a template file.
<label for="user-question">Ask a question about Ember:</label>
<Input
id="user-question"
@type="text"
@value="How do text fields work?"
/>
<Textarea>
: The following example shows how to bind this.userComment
to a text area's value.
<label for="user-comment">Comment:</label>
<Textarea
id="user-comment"
@value={{this.userComment}}
rows="6"
cols="80"
/>
Setting attributes on <Textarea>
: With the exception of
@value
argument, you can use any
attribute that
<textarea>
natively supports.