Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

148
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda