Angularjs set checkbox checked
home
Run
screen_rotation
fullscreen
cloud_download
<!DOCTYPE html> <html lang="en"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script> <script> var myApp = angular.module("myApp", []); myApp.controller("myController", function($scope) { $scope.checkBoxChecked = function() { if(!$scope.master){ $scope.master = true; }else{ $scope.master = false; } } }); </script> </head> <body> <div ng-app="myApp"> <div ng-controller="myController"> <button ng-click ="checkBoxChecked()" ng-model='master'>Click to Check </button> <br> <input type="checkbox" ng-checked ="master"> <br> </div> </div> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script> <script> var myApp = angular.module("myApp", []); myApp.controller("myController", function($scope) { $scope.checkBoxChecked = function() { if(!$scope.master){ $scope.master = true; }else{ $scope.master = false; } } }); </script> </head> <body> <div ng-app="myApp"> <div ng-controller="myController"> <button ng-click ="checkBoxChecked()" ng-model='master'>Click to Check </button> <br> <input type="checkbox" ng-checked ="master"> <br> </div> </div> </body> </html>
Copyrights@tutorialsplane.com