Using template input helpers
To create common form controls, input
helpers can be used. This recipe will go over how to use them in our Ember applications.
How to do it...
The most common input
helper is {{input}}
. It wraps around the Ember.TextField
view and is almost identical to the traditional <input>
HTML element.
- Create a new project. In the
app/templates
folder, open theapplication.hbs
file and add aninput
helper:// app/templates/application.hbs <h2 id="title">Welcome to Ember</h2> <br> <br> {{input value='Hello World'}}
This
input
helper is very simple; all it does is set the value of the textbox tohello world
. It is surrounded by double curly braces and supports the normal input attributes. - When rendered, it will look as follows:
<h2 id="title">Welcome ...
Get Ember.js Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.