Home > Web Front-end > HTML Tutorial > angularjs-display HTML elements

angularjs-display HTML elements

高洛峰
Release: 2017-02-13 15:18:08
Original
1477 people have browsed it

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title></title>
	<link rel="stylesheet" href="">
</head>
<body>
	<div ng-app="myApp" ng-controller="personCtrl">
		<button ng-click="toggle()">显示/隐藏</button>
		<p ng-show="myVar">
			名:<input type="text" ng-model="firstName"><br/>
			姓:<input type="text" ng-model="lastName"><br/>
			<br>
			Full Name:{{firstName + " " + lastName}}
		</p>
	</div>
</body>
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script>
	var app = angular.module(&#39;myApp&#39;,[]);
	app.controller(&#39;personCtrl&#39;,function($scope){
		$scope.firstName = "John";
		$scope.lastName = "Doe";
		$scope.myVar = true;
		$scope.toggle = function(){
			$scope.myVar = !$scope.myVar;
		}
	});
</script>
</html>
Copy after login

For more angularjs-display HTML elements related articles, please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template