By default we can keep the status of Checkbox as checked or unchecked based on the data taken from external sources. The external source can be MySQL database or any CSV file or any other sources. The final output is available in JSON format here. You can read more on JSON data format here.
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, $http) {
$http.get("form-checkbox-data.php") // data source for selection
.then(function (response) {
$scope.Python = response.data.checkbox_data.Python; // true
$scope.Angular = response.data.checkbox_data.Angular; // false
$scope.JQuery = response.data.checkbox_data.JQuery; // true
});
});
</script>
Output of the file form-checkbox-data.php in JSON format is here
{"checkbox_data":{"Python":true,"Angular":false,"JQuery":true}}
← Checkbox
← Angular Home