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

251
Vistas
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?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You can do this,

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

and in typescript,

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

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){        
   }
}
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