Credit: @rwjblue's twiddle
Demo: http://ember-twiddle.com/2d7246875098d0dbb4a4
This addon provides a simple and consistent API to add form controls to your app. Each form control will not update the passed in value(s) directly. Instead it will send the update
action with the updated value.
If you do not know the type of input before hand you could do the following:
Each of the controls are documented in more detail in their own readme's:
With Glimmer landing in 1.13.x, native <input>
elements can now be used in your apps, without the two way binding semantics of the {{input}}
helper. Shifting to one way bindings ("data down, actions up") makes your app easier to reason about and debug, and is generally the idiomatic way of building Ember apps going forward.
Unfortunately, there is a small gotcha with using a native input like so:
In the following demo, move your cursor to a character in the middle of the value, and attempt to input new text. You will notice that your cursor immediately jumps to the end of the string, which is entirely unintuitive and annoying.
This addon fixes the cursor jumping issue by using readDOMAttr
, which provides a way to read an element's attribute and update the last value Ember knows about at the same time. This makes setting an attribute idempotent.
Note: The cursor jumping issue has been fixed in Ember since 2.3.1.
This addon will work on Ember versions 1.13.x
and up.
ember install ember-one-way-controls
git clone
this repositorynpm install
bower install
ember server
- Visit your app at http://localhost:4200.
ember test
ember test --server
ember build
For more information on using ember-cli, visit http://www.ember-cli.com/.
DockYard, Inc © 2016