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
?