<!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;width: 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>
时间: 2024-08-08 01:27:29