<html>
<body>
<div ng-app="" ng-controller="personController">
<button ng-click="toggle()">隐藏/显示</button>
<p ng-show="myVar">
名: <input type="text" ng-model="person.firstName"><br>
姓: <input type="text" ng-model="person.lastName"><br><br>
姓名: {{person.firstName + " " + person.lastName}}
</p>
</div>
<script>
function personController($scope) {
$scope.person = {
firstName: "John",
lastName: "Doe"
};
$scope.myVar = true;
$scope.toggle = function() {
$scope.myVar = !$scope.myVar;
};
}
</script>
<script src="https://libs.baidu.com/angular.js/1.2.5/angular.min.js"></script>
</body>
</html>