Skip to content

Instantly share code, notes, and snippets.

@kumkanillam
Last active August 21, 2017 10:15
Show Gist options
  • Save kumkanillam/294c4d26f6f65f46fe9113f251a92293 to your computer and use it in GitHub Desktop.
Save kumkanillam/294c4d26f6f65f46fe9113f251a92293 to your computer and use it in GitHub Desktop.
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions:{
numberValidate(value){
this.send('numberValidateInRoute',value);
//check for condition before focussing.
Ember.$('.input1')[0].focus()
}
}
});
import Ember from 'ember';
export default Ember.Route.extend({
actions:{
numberValidateInRoute(value){
console.log(" value ",value);
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<span class="opt-num">
<input type="number" tabindex="1" min="0" max="9" maxlength="1" value="" onKeyUp={{action "numberValidate" value="target.value"}} style="border:1px solid red" >
<input class="input1" type="number" min="0" max="9" maxlength="1" value="" onKeyUp={{action "numberValidate"}} style="border:1px solid red" >
</span>
<br>
{{outlet}}
<br>
<br>
{
"version": "0.12.1",
"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.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment