Skip to content

Commit

Permalink
Merge pull request #638 from ryanwawr/inputMaskValueFix
Browse files Browse the repository at this point in the history
Fix for issue #587 - Input mask with ngModel lags by one character
  • Loading branch information
cagataycivici committed Jul 23, 2016
2 parents 545f911 + 2648e50 commit f75a533
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions components/inputmask/inputmask.ts
Expand Up @@ -66,9 +66,15 @@ export class InputMask implements AfterViewInit,OnDestroy,ControlValueAccessor {
placeholder: this.slotChar,
clearIncomplete: this.clearIncomplete,
clearMaskOnLostFocus: this.clearMaskOnLostFocus,
onKeyDown: (event, buffer, caretPos, opts) => {
let val = this.unmask ? jQuery(this.el.nativeElement.children[0])['inputmask']('unmaskedvalue') : event.target.value;
this.onModelChange(val);
onKeyDown: (event, buffer, caretPos, opts) => {
let val = this.unmask ? jQuery(this.el.nativeElement.children[0])['inputmask']('unmaskedvalue') : event.target.value;
this.onModelChange(val);
},
onBeforeWrite: (event, buffer, caretPos, opts) => {
if(event.target != null){
let val = this.unmask ? jQuery(this.el.nativeElement.children[0])['inputmask']('unmaskedvalue') : event.target.value;
this.onModelChange(val);
}
},
oncomplete: (event) => {
this.onComplete.emit(event);
Expand Down

0 comments on commit f75a533

Please sign in to comment.