Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

147
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 4 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 4 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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda