We can select only one of the available options in case of radio buttons , in case of Checkboxes we can select more than one options.
Python
Angular
JQuery
Python : {{Python}}, Angular : {{Angular}}, JQuery : {{JQuery}}
<div ng-app="my_app" ng-controller="my_ctrl">
<input type=checkbox ng-model="Python" > Python
<input type=checkbox ng-model="Angular"> Angular
<input type=checkbox ng-model="JQuery"> JQuery
<br><br>
Python : {{Python}}, Angular : {{Angular}}, JQuery : {{JQuery}}
</div>
<script>
var app = angular.module('my_app', []);
app.controller('my_ctrl', function($scope) {
});
</script>
Default selected Checkbox
We can't add the attribute checked to the checkbox to make it selected by default. We have to set the value for ng-model to make it selected.
DEMO : Default selection of Checkbox →
Default data from external source
Default status ( checked or unchecked ) can be set by taking data from external sources in JSON format. Such external source can be MySQL database or from CSV file or from any other storage process.
DEMO : Default selection of Checkbox using data from external sources →
onChange event of Checkbox
We can read and display the values of a group of checkboxes by using onChange event of any checkbox.
DEMO : OnChange event of Checkbox →
Managing a group of checkboxes
By using one checkbox we can copy the status to a group of checkboxes.
DEMO : Managing group of Checkboxes →
← Angular Home