How to know if a checkbox is checked?
<p>Here is the code:</p>

<pre><code>&lt;input type="checkbox" value="Blue" (click)="var=$event.target.getAttribute('value')" /&gt;
</code></pre>

<p>When I to print <code>var</code> on console, I get the <code>value</code> of the checkbox  '<code>Blue</code>' but what if I want to get if the checkbox is checked or not?</p>

<p>I have tried this but I get <code>undefined</code>:</p>

<pre><code>&lt;input type="checkbox" value="Blue" (click)="var=$event.target.getAttribute('checked')" /&gt;
</code></pre>