ng-click

<!DOCTYPE html>
<html lang="en" ng-app="btn">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="angular.js"></script>
</head>
<body>
<div ng-controller="con1">
<input type="button" value="按钮" ng-click="a=!a">
<div style="background: red; 300px;height: 300px;" ng-show="a"></div>
</div>
<script>
var app=angular.module('btn',[]);
app.controller('con1',function ($scope) {
$scope.a = true;
})
</script>
</body>
</html>
原文地址:https://www.cnblogs.com/qiudongjie/p/6562144.html