Issue
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?
Solution
You can do this,
<input type="checkbox" id="isCheckBox" (change)="yourfunc($event)"/>
and in typescript,
yourfunc(e) {
if(e.target.checked){
}
}