0
首先,我一直试图从jsfiddle复制这个摘录:http://jsfiddle.net/PQvQ2/1245/,并且每当我尝试在我的代码中添加ng-model = selection.ids [catagory.id]时,它抛出Va(...)未定义的错误。Angular ng-model Syntax not working
这是我的代码`
<form ng-controller="formController">
<div class="form-group">
<tr ng-repeat="table in districtArray" id="rowId-{{table.schoolId}}" class="unselected-row">
<td>
<label class="table-center-align table-checkbox-label box-unchecked" for="{{table.schoolId}}">
<input class="table-checkbox box-unchecked" type="checkbox" ng-model="checkboxData.Id[table.schoolId]" id="{{table.schoolId}}">
<span ng-click="updateSelection(table.schoolId)"></span>
</label>
</td>
</tr>
</div>
</form>`
这是推动我坚果为什么这是行不通的。控制器放置在一个模板中,并通过示波器。
app.controller('distDashController', function($scope,$http,$timeout,$routeParams,adminDataCache) {
....
function formController($scope){
$scope.checkboxData.Id=$scope.table.schoolId;
$scope.checkboxData.checked = checked;
};
我只是想里面checkboxData愚蠢的数据如下所示:
{ "table.schoolId": boolean value, "table.schoolId": boolean value }
请,为什么不是这方面的工作?!?!
你的小提琴作品对我来说 – garethb
http://jsfiddle.net/8e9x505d/是不是? – Errorpro
它也适用于我:D –