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

183
Vistas
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 Respuestas
Responde la pregunta

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 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