My problem is that I'm trying to access these checkboxes from inside the controller so I can set them to true from there.
For some reason, I can't figure out the correct ng-model to use for these checkboxes such that I have the ability to do so, while maintaining that each one has a unique name.
<accordion-group ng-repeat="group in groups">
<accordion-heading>{{group.title}}</accordion-heading>
<div ng-repeat="collection in group.collections">
<div class="checkbox collection-legend" style="background-color: {{collection.color}}">
<label><input type="checkbox" ng-click="toggleCollection(collection.key)" ng-model="checkboxes[collection.key]"> {{collection.name}}: <em>{{collection.description}}</em></label>
<div class="customFields">
<label ng-repeat="(key, val) in collection.queries" ng-if="key != 'default' && key != 'dateRangeKey'">
<input class="form-text" ng-model="customProperties[collection.name + '-' + key]" type="text"><em>{{key}}</em></label>
</div>
</div>
</div>
</accordion-group>
For some context, I'm trying to set up a "restore session" method, where the user can bring back up old forms submitted without having to fill them out again, so I have the list of checkboxes that need to be "rechecked", I just can't figure out how to name my model so I can do it.
ng-model="checkboxes[collection.key]" seems like it should work here. Any advice?
And then $scope.checkboxes[key] = true in the controller. (key matches collection.key; I've already confirmed this). Getting a "can not set (key) of undefined" error.
Aucun commentaire:
Enregistrer un commentaire