Camila Waz 发布于
2018-08-23 17:06:14

angular.js ng-click点击事件切换类

angular.js ng-click点击事件切换类
<!DOCTYPE html>
<html>
<head>
<style>
.c {padding: 20px;background: #00adff;}
.a {background: #43dd31;}
.b {border: 5px dashed yellow;}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
</head>
<body>
<div ng-app="">
  <div class="c" ng-class="{'a': toggle, b: secondToggle}">
    <button ng-click="toggle = !toggle">Toggle</button>
    <button ng-click="secondToggle = !secondToggle">Second Toggle</button>
  </div>
</div>
</body>
</html>
当前文章内容为原创转载请注明出处:http://www.good1230.com/detail/2018-08-23/204.html
最后生成于 2020-08-31 16:48:51