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

247
Views
How to call a function on checking a checkbox in angular 2.0

I am currently using angular 2.0. In HTML, I have a checkbox, the code is as mentioned below.

<div style="margin-left:15px;">
            <label>Draw</label>
            <input id="isCheckBox" type="checkbox" checked="checked">
</div>

How to call a function only if a checkbox is checked in typescript file?

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You can do this,

<input type="checkbox"  id="isCheckBox" (change)="yourfunc($event)"/>

and in typescript,

yourfunc(e) {
   if(e.target.checked){        
   }
}
about 4 years ago · Santiago Trujillo Report

0

You can use currentTarget if target won't work,

<input type="checkbox"  id="isCheckBox" (change)="yourfunc($event)"/>

and in typescript,

yourfunc(e) {
   if(e.currentTarget.checked){        
   }
}
about 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!