• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

107
Vistas
Call method as user paste in textbox
<textarea name="" id="" #text cols="30" (keydown)="Counter()" (change)="Counter()" rows="8" [(ngModel)]="user_text" placeholder="Please write"></textarea>

I have this textarea i want to call counter method when the user types in the textarea

 wordCounter() {
    this.count= this.user_text.trim().split(/\s+/).length;
 }

this is working but when i paste anything in textarea then value not gets updated and value only gets updated when i click on window. I want count should get updated as soon user paste anything in textarea

Thanks

about 3 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Since your using Angular I would recommend using the formbuilder instead of NgModule and subscribe to the events there.

Checkout an example here: https://stackblitz.com/edit/angular-ivy-rwjwd5?file=src/app/app.component.ts

and Documentation here: https://angular.io/api/forms/FormBuilder

about 3 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda