AngularJS Basic ng readonly Simple Example
- 2021-07-07 06:32:43
- OfStack
AngularJS ng-readonly Directive
AngularJS instance
Set the input box to read-only:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body ng-app="">
Check the check box to set the input box to read-only :<input type="checkbox" ng-model="all"><br>
<br>
<input type="text" ng-readonly="all">
</body>
</html>
Definition and usage
The ng-readonly directives are used to set the readonly property of the form field (input or textarea).
If the expression for the ng-readonly property returns true, the form field is read-only.
Grammar
<
input ng-readonly="expression"
>
<
/input
>
<
input
>
<
textarea
>
Element supports this directive.
Parameter value
值 | 描述 |
---|---|
expression | 表达式返回 true 则表单域为只读。 |
The above is the AngularJS ng-readonly data collation, follow-up to continue to supplement relevant information, thank you for your support to this site!