I try to update an input value in Angular 2, it works the first time the 
size value exceeds maxSize, but afterwords it does not work anymore. It 
seems like when I am setting this.size to some value the UI is not updated, 
am I overlooking something ? 

HTML:

<input type="text" class="form-control" [value]="size" (input)="size = 
updateValue($event)">



Code:

export class BrushSizePicker {
@Input() minValue;
@Input() maxValue;
@Input() size;

increaseValue(event) {
this.size++;

this.checkValue();
}

decreaseValue(event) {
this.size--;

this.checkValue();
}

updateValue(event) {
this.size = parseInt(event.target.value);
this.checkValue();

return this.size;
}

private checkValue() {
if (this.size > this.maxValue) {
  this.size = this.maxValue;
}
if (this.size < this.minValue) {
  this.size = this.minValue;
}

}


I logged what happened: checkValue is called every time with the correct 
input, and it returns the correct value. But the new value is not set into 
the input field / value field


Thanks for your help

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to