Add ng-disabled attribute to an HTML button and pass it a model. Bind the model to a checkbox and see the variation.
<html>
<title> AngularJs Directives </title>
<head>
<title>Angular JS Table</title>
<style>
table, th , td {
border: 1px solid grey;
border-collapse: collapse;
padding: 5px;
}
table tr:nth-child(odd) {
background-color: #f2f2f2;
}
table tr:nth-child(even) {
background-color: #ffffff;
}
</style>
</head>
<body>
<div ng-app="" ng-controller="firstController">
<table>
<tr>
<td>
<input type="checkbox" ng-model="enableDisableButton">Disable Button
</td>
<td>
<button ng-disabled="enableDisableButton">Click Me</button>
</td>
</tr>
</table>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
<!--
<script>
function firstController($scope)
{
$scope.data={
firstname:'Shekhar',
lastname:'Nawale',
subject:[{name:'Physics',marks:'40' },{name:'Chemistry',marks:'50' },{name:'Math',marks:'60' },{name:'Biology',marks:'70' }],
fees:'100',
fullname: function()
{
var name=$scope.data;
return name.firstname + ' ' + name.lastname;
}
};
}
</script>
-->
</body>
</html>
<html>
<title> AngularJs Directives </title>
<head>
<title>Angular JS Table</title>
<style>
table, th , td {
border: 1px solid grey;
border-collapse: collapse;
padding: 5px;
}
table tr:nth-child(odd) {
background-color: #f2f2f2;
}
table tr:nth-child(even) {
background-color: #ffffff;
}
</style>
</head>
<body>
<div ng-app="" ng-controller="firstController">
<table>
<tr>
<td>
<input type="checkbox" ng-model="enableDisableButton">Disable Button
</td>
<td>
<button ng-disabled="enableDisableButton">Click Me</button>
</td>
</tr>
</table>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
<!--
<script>
function firstController($scope)
{
$scope.data={
firstname:'Shekhar',
lastname:'Nawale',
subject:[{name:'Physics',marks:'40' },{name:'Chemistry',marks:'50' },{name:'Math',marks:'60' },{name:'Biology',marks:'70' }],
fees:'100',
fullname: function()
{
var name=$scope.data;
return name.firstname + ' ' + name.lastname;
}
};
}
</script>
-->
</body>
</html>
No comments:
Post a Comment