angular+点击按钮,隐藏和显示F12打印状态

来源:互联网 发布:一键传淘宝的弊端 编辑:程序博客网 时间:2024/05/01 10:38
<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>Title</title>    <style>        .box{            width: 100px;            height: 100px;            background: red;        }    </style>    <script src="angular/angular.js"></script>        <script>            var myapp=angular.module("myapp",[]);            myapp.controller("myCtrl",function ($scope) {                $scope.show=true;                $scope.fun=function () {                    $scope.show=!$scope.show;                    console.log($scope.show);                }                $scope.hide=true;$scope.func=function () {    $scope.hide=!$scope.hide;}            })        </script></head><body ng-app="myapp" ng-controller="myCtrl"><div class="box"ng-show="show"></div><button ng-click="fun()">点击切换</button><div ng-class="{box:hide}"></div><button ng-click="func()">按钮</button></body></html>