Is it possible for AngularJS to automatically bind all values (options) when a user selects something from a list, populating them via the model? How could I achieve a similar functionality with checkboxes? I want a select for multiple values and a checkbox for single values without making significant changes to the code.
Currently, my select looks like this:
<div ng-repeat="event in allElements"
<select ng-model="event.selectedElement" ng-change="updateSelectedElements(event);"
<option value>Select date</option>
<option value>{[{ getDate(event.elements) }]}</option>
</select>
</div>
The updateSelectedElements function manipulates the list. How can I apply the same concept to checkboxes? Can a checkbox 'bind' selected elements just like a select does, even though its value is limited to true/false compared to the options available in a select?
I attempted:
<input type="checkbox" ng-model="event.selected" ng-change="updateSelectedElements(event)" />
However, event.selectedElement returns null with checkboxes, unlike with selects where it works. Do I need to manually set event.selectedElement using a function? This process confuses me.