My data looks like, where each entry is log
, coming from SupportService
var getDummyLogsForNow = function () {
return [
{
"fileName": "file A",
"location": "logs/fileA",
"size": "20000",
"lastUpdated": "May 04, 2015 09:21PM"
},
{
"fileName": "file B",
"location": "logs/fileB",
"size": "4034300",
"lastUpdated": "May 01, 2015 01:21PM"
},
{
"fileName": "file C",
"location": "logs/fileC",
"size": "53437000",
"lastUpdated": "May 02, 2015 03:11PM"
}
]
};
return {
logs: getDummyLogsForNow()
};
In my controller, I use it as
$scope.logs = SupportService.logs;
$scope.selectedLogs = ["file C"];
and this is how I print them up on HTML table
<table class="logsTable">
<thead>
<tr>
<th>#</th>
<th>File Name</th>
<th>Last Updated</th>
<th>Size</th>
<th>Location</th>
</tr>
</thead>
<tr ng-repeat="log in logs">
<td>
<input type="checkbox"
ng-checked="selectedLogs.indexOf(log.fileName) != -1"
ng-click="toggleSelect(log)">
</td>
<td>{{log.fileName}}</td>
<td>{{log.lastUpdated}}</td>
<td>{{log.size}}</td>
<!--<td>{{log.location}}</td>-->
<td>{{selectedLogs.indexOf(log.fileName) != -1}}</td>
</tr>
</table>
Even though one of the entries if true
, the checkbox
is not checked. All I see is
What's the issue here?