Home >Web Front-end >JS Tutorial >AngularJS ng-disabled directive

AngularJS ng-disabled directive

黄舟
黄舟Original
2017-02-16 13:38:081294browse

1. Problem background

The ng-disabled directive in AngularJS binds DOM and can disable HTML elements


2. Implementation source code

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>AngularJS之ng-disabled指令</title>
		<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
	</head>
	<body>
		<p ng-app="" ng-init="flag=true">
			<button ng-disabled="flag">查询</button><br>
			<input type="checkbox" ng-model="flag" />老鼠<br>
			<input type="radio" ng-disabled="!flag" />猫<br>
			<label>{{flag}}</label>
		</p>
	</body>
</html>


3. Implementation result


(1) Check the check box

' AngularJS ng-disabled directive

(2) Uncheck the check box

AngularJS ng-disabled directive

The above is the content of the ng-disabled directive of AngularJS. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn