Skip to content

Instantly share code, notes, and snippets.

@jherdman
Created February 24, 2017 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jherdman/61645ec16fca7f5ff5a65c2b407ce94c to your computer and use it in GitHub Desktop.
Save jherdman/61645ec16fca7f5ff5a65c2b407ce94c to your computer and use it in GitHub Desktop.
range elements report wrong initial value
import Ember from 'ember';
export default Ember.Component.extend({
didRender() {
let nativeValue = this.$('#native').val();
this.set('nativeValue', nativeValue);
let emberValue = this.$('#ember-helper').val();
this.set('emberValue', emberValue);
},
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h2>Using a native input</h2>
<input type="range" min="0" max="10" id="native">
<p>My reported value is: {{nativeValue}}</p>
<hr>
<h2>Using a helper</h2>
{{input type="range" min=0 max=10 id="ember-helper"}}
<p>My reported value is: {{emberValue}}</p>
{
"version": "0.11.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.10.2",
"ember-data": "2.11.0",
"ember-template-compiler": "2.10.2",
"ember-testing": "2.10.2"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment