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

182
Visualizações
Detect input value change on Angular 2 that emmited from 3rd party js library

I'm implement datepicker on my form, with help from 3rd party datepicker library (jQuery, etc). It works when user select the date, but Angular can't detect change emmited from datepicker (e.g. when I choose date).
Here is my code :
HTML

<input type="text" id="dateOfBirth" name="dateOfBirth" formControlName="dateOfBirth" value="{{selectedEmployee.dateOfBirth}}" (ngModelChange)="dateFieldChanged()" readonly>

TS

dateFieldChanged() {
  console.log('date changed!');
}

It supposed to execute dateFieldChange(), isn't it? So that I can determine whether form still pristine or already dirty. But the method never executed.
I assume it's because 3rd party datepicker javascript that change the value, so that Angular not detect it.
How to work around this problem?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I've managed to do it. Since I'm targetting modern browser (!= IE8 below), I only need to change the input type to be "date"

<input type="date" id="dateOfBirth" name="dateOfBirth" formControlName="dateOfBirth" value="{{selectedEmployee.dateOfBirth}}" (ngModelChange)="dateFieldChanged()">
over 4 years ago · Santiago Trujillo 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