48
rated 0 times
[
50]
[
2]
/ answers: 1 / hits: 19804
/ 7 Years ago, fri, july 7, 2017, 12:00:00
I have textarea. I try to restrict width of value to 10 symbols. I am trying to cut value on input
event.
<textarea [(ngModel)]=smsMessage (input)=changeSMSMessage()></textarea>
changeSMSMessage() {
this.smsMessage = this.smsMessage.substr(0, 10);
console.log(this.smsMessage);
}
But it doesn't work. I see that value was cut in changeSMSMessage()
method, but on UI I see not changed value.
Plunker
When I changed event from input
to keyup
, it starts work properly. All characters after the tenth are deleted.
So, could someone explain why is input
event doesn't update value in textarea
?
More From » angular