Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

181
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!