how to display a textbox in disabled and read-only in angularjs?
Hello everyone, I am going to share the code sample for
display a textbox in readonly mode using ng-readonly attribute and disabled to button using ng- disabled in angularjs as given
below.
The click for live
plunker demo http://embed.plnkr.co/fHqDy3/preview
The example for
using ng-readonly and ng-disabled
<!doctype html>
<html lang="en" ng-app="">
<head>
<meta charset="UTF-8">
<title>how to disable and read-only
text-box in angularjs?</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
</head>
<body ng-init="isDisabled =
true">
<h1>Check to checkbox for make
readonly to the TextBox</h1>
<input type="checkbox" ng-model="checked">Checked checkbox for Edit
TextBox
<input type="text" ng-readonly="!(checked)" value="www.code-sample.com" />
<button ng-disabled={{isDisabled}}>Button</button>
</body>