Tuesday, January 30, 2018

How to write a program for DOM in angularJS.

  • The ng-disabled directive binds the application data mySwitch to the HTML button's disabled attribute.
  • The ng-model directive binds the value of the HTML checkbox element to the value of mySwitch.
  • If the value of mySwitch evaluates to true, the button will be disabled


Program
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js">
</script>
</head>
<body>
<div ng-app="" ng-init="mySwitch=true">
<p>
<button ng-disabled="mySwitch"> click me
</button>
</p>
<p>
<input type="checkbox" ng-model="mySwitch"> Button
</p>
<p>
{{ mySwitch }}
</p>
</div>
</body>
</html>

Output



0 comments:

Post a Comment

Thanks For Commented.

TechTalk