I am trying to get and set a boolean to 'checkvalue'. I want beforehand to call a function isItTrue to set the variable 'checkvalue'. If the box is (un)checked/ and I check it, it should call a function doSomething().
I was experimenting with <input type="checkbox" id="{{ class.id }}" ng-init="checkBoxValue=isItTrue(class.id)"[(ngModel)]="class['checkBoxValue']"/>
but it doesnt seem to work. Any suggestions?
<table>
<thead>
<tr>
<th>class</th>
<th>subjects</th>
<th>class speaker</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let class of classes">
<td>{{ class.name }}</td>
<td>
<div class="form">
<input type="text" class="md-input-text" placeholder=" " value=" " [(ngModel)]="subject"/>
<label class="md-desc">subjects</label>
</div>
</td>
<td>
<div class="md-checkbox">
<input type="checkbox" id="{{ class.id }}" [(ngModel)]="class['checkBoxValue']"/>
<label for="{{ class.id }}"></label>
</div>
</td>
</tr>
</tbody>
</table>