Reputation: 1
First, I've been trying to replicate this excerpt from jsfiddle: http://jsfiddle.net/PQvQ2/1245/ and whenever I attempt to add in the ng-model=selection.ids[catagory.id] in my code, it throws an error that Va(...) is undefined.
This is my code `
<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>`
This is driving me nuts on why this isn't working. The controller is placed within a template and its passed in the scope.
app.controller('distDashController', function($scope,$http,$timeout,$routeParams,adminDataCache) {
....
function formController($scope){
$scope.checkboxData.Id=$scope.table.schoolId;
$scope.checkboxData.checked = checked;
};
I simply want the stupid data inside checkboxData to look like the following:
{
"table.schoolId": boolean value,
"table.schoolId": boolean value
}
PLEASE, why isn't this working?!?!
Upvotes: 0
Views: 83
Reputation: 3309
You declared your function inside another controller with different name, so it doesn't work as expected in your jsfiddle example. Please use angular controllers instead of simple function. For example see this
app.controller('formController', function ($scope) {
// your code
}
Upvotes: 1