我有這個html代碼,它使用angularjs來顯示錶中的內容。將此數字字符更改爲angularjs上的表格內的複選框
<div ng-controller="CheckCtrl">
<table class="table table-hover data-table sort display">
<thead>
<tr>
<th class="Serial_">
Serial
</th>
<th class="Name_">
Name
</th>
<th class="ID_">
ID
</th>
<th class="On_off_">
On/off
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in check_items">
<td>{{item.SERIAL}}</td>
<td>{{item.NAME}}</td>
<td>{{item.ID}}</td>
<td>{{item.ON_OFF}}</td>
</tbody>
</table>
</div>
該網頁看起來像這樣;
這裏是控制器的代碼。
.controller('CheckCtrl', ['$scope', '$http', 'configuration',
function ($scope, $http, $configuration) {
var url_api = $configuration.host + "cloe/webroot/cloe-cloud/app/API.json";
$http.get(url_api).success(function(data)
{
$scope.check_items = data;
});
我想將開/關列數字字符更改爲複選框。如果數字字符爲'0',則複選框未被選中。如果數字字符爲'1',則複選框被選中。
我正在使用angularjs v1和twitter bootstrap。
編輯:對不起,我意識到我的複選框值是一個字符,而不是數字。它們是'0','1'而不是0,1。
通過將輸入更改爲複選框來嘗試此ng-checked =「item.ON_OFF == 0」如果您可以爲我們製作一個調度器 –