AngularJS : AngularDOM

Mahir Koding – AngularJS juga mempuyai fitur untuk mengatur sebuah elemen berdasarkan value form component. Sebagai contoh simple adalah component checkbox, kita bisa mentrigger element lain berdasarkan hasil checkbox tersebut. Atau, kita juga bisa mengatur visibility dari sebuah element dengan menggunakan directive ng-show atau ng-hide.

<!DOCTYPE html>
<html>
<head>
	<title>AngularJS - Tutorial</title>
	<script type="text/javascript" src="js/angular.min.js"></script>
</head>
<body ng-app="myApps">
	<div ng-controller="registerCtrl">
		<h1>Register</h1>
		<p>
			<input type="text" ng-model="name" placeholder="Insert Name">
		</p>
		<p>
			<input type="number" ng-model="age" placeholder="Insert Age">
		</p>
		<p ng-show="age<17">
			<input type="text" ng-model="fatherName" placeholder="Insert Father Name">
		</p>
		<p>
			<input type="checkbox" ng-model="check">I Agree with Lisence Agreement
		</p>
		<input type="submit" ng-disabled="!check">
	</div>
</body>
<script type="text/javascript" >
	var app = angular.module("myApps", []);
	app.controller("registerCtrl", function($scope){
		
	});
</script>
</html>

Jika ada pertanyaan yang kurang jelas silahkan berkomentar di bawah. Atau, jika ingin request tutorial juga dapat ke halaman ini. Dukung terus Mahir Koding agar dapat selalu mengupdate artikel dengan share dan like artikel ini. Terima Kasih.