matth3o matth3o - 1 year ago 142
Dart Question

Dart Angular2 - bind component boolean with checkbox value

I'd like to know if there is a way to bind a regular checkbox in a template :

<input type="checkbox">

with a boolean in my component.

Bonus question : Otherwise is there a way to do

<input type="checkbox" {{mybool ? 'checked' : ''}}>


Answer Source
<input type="checkbox" [checked]="mybool">


<input type="checkbox" [(ngModel)]="mybool">