lundi 23 mars 2015

Need to get checkboxes checked in Angular if-statement

I have two lists of IDs that I need to check against. If they match then that check-box should be checked. I'm new to angularJs so please help me width this. My code looks like this now. allMedia is a object with many values. mediaIdFromSpecifikLead is just a list with int id.



<tr ng-repeat="media in allMedia">
<div ng-repeat="mediaFromLead in mediaIdFromSpecificLead">
<div ng-if="media.Id == mediaFromLead ">
<td>
<input type="checkbox" ng-checked="true" />
</td>
</div>
<div ng-if="media.Id != mediaFromLead ">
<td>
<input type="checkbox" ng-checked="false" />
</td>
</div>
</div>
</tr>


With this code it even shows TWO check-boxes (one checked and one empty) so not even that works so I have probably done this totally wrong.


Aucun commentaire:

Enregistrer un commentaire