Is it possible to use standard HTML5 input fields in an Ember.js view, or are you forced to use the limited selection of built in fields like Ember.TextField, Ember.CheckBox, Ember.TextArea, and Ember.select? I can't seem to figure out how to bind the input values to the views without using the built in views like:
Input: {{view Ember.TextField valueBinding="objectValue" }}
Specifically, I'm in need of a numeric field. Any suggestions?
EDIT: This is now out of date you can achieve everything above with the following:
{{input value=objectValue type="number" min="2"}}
Outdated answer
You can just specify the type for a TextField
If you want to access the extra attributes of a number field, you can just subclass
Ember.TextField
.You may also wish to prevent people from typing any old letters in there:
Credit where its due: I extended nraynaud's answer
Here is my well typed take on it :
I use it that way:
The other systems where propagating strings into number typed fields.
@Bradley Priest's answer above is correct, adding type=number does work. I found out however that you need to add some attributes to the Ember.TextField object if you need decimal numbers input or want to specify min/max input values. I just extended Ember.TextField to add some attributes to the field:
In the template:
et voile!
This is how I would do this now (currently Ember 1.6-beta5) using components (using the ideas from @nraynaud & @nont):
Then, to include it in a template: