Skip to content

Instantly share code, notes, and snippets.

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 scottkidder/13f5a773f9a0ca9503977b821c74efb4 to your computer and use it in GitHub Desktop.
Save scottkidder/13f5a773f9a0ca9503977b821c74efb4 to your computer and use it in GitHub Desktop.
Change value in response to update action on one way number mask
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
num: 0,
actions: {
update(unmaskedValue, value){
let number = parseInt(unmaskedValue, 10);
if(number > 15){
this.set('num', 15);
Inputmask.setValue('input', 15);
} else {
this.set('num', number);
}
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
{{one-way-number-mask value=num decimal=false update=(action 'update')}}
{
"version": "0.14.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "2.18.2",
"ember-template-compiler": "2.18.2",
"ember-testing": "2.18.2"
},
"addons": {
"ember-data": "2.18.2",
"ember-inputmask": "0.7.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment