Skip to content

Commit

Permalink
Fixed #134
Browse files Browse the repository at this point in the history
  • Loading branch information
Çağatay Çivici committed Mar 24, 2016
1 parent 2870d3a commit 314114f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/spinner/spinner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {DomHandler} from '../dom/domhandler';
<span class="ui-spinner ui-widget ui-corner-all">
<input #in id="basic" pInputText type="text" class="ui-spinner-input"
[attr.size]="size" [attr.maxlength]="maxlength" [attr.readonly]="readonly" [attr.disabled]="disabled"
(keydown)="onInputKeydown($event,in)" (input)="onInput($event)" (blur)="in.value = value" (change)="handleChange($event)">
(keydown)="onInputKeydown($event,in)" (input)="onInput($event)" (blur)="onBlur(in)" (change)="handleChange($event)">
<a class="ui-spinner-button ui-spinner-up ui-corner-tr ui-button ui-widget ui-state-default ui-button-text-only"
[ngClass]="{'ui-state-hover':hoverUp,'ui-state-active':activeUp,'ui-state-disabled':disabled}"
(mouseenter)="onUpButtonMouseenter($event)" (mouseleave)="onUpButtonMouseleave($event)" (mousedown)="onUpButtonMousedown($event,in)" (mouseup)="onUpButtonMouseup($event)">
Expand Down Expand Up @@ -190,6 +190,12 @@ export class Spinner implements AfterViewInit {
this.valueChange.next(this.value);
}

onBlur(inputElement) {
if(this.value !== undefined && this.value !== null) {
inputElement.value = this.value;
}
}

parseValue(val: string): number {
let value: number;
if(val.trim() === '') {
Expand Down

0 comments on commit 314114f

Please sign in to comment.