最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

AngularJS使用ng-class動態(tài)增減class樣式的方法示例

 更新時(shí)間:2017年05月18日 11:44:48   作者:itsonglin  
這篇文章主要介紹了AngularJS使用ng-class動態(tài)增減class樣式的方法,結(jié)合具體實(shí)例形式分析了ng-class操作頁面class樣式的相關(guān)技巧,需要的朋友可以參考下

本文實(shí)例講述了AngularJS使用ng-class動態(tài)增減class樣式的方法。分享給大家供大家參考,具體如下:

使用ng-class可以實(shí)現(xiàn)動態(tài)地增減樣式:

<!DOCTYPE html>
<html ng-app="formExample">
<head>
  <meta charset="UTF-8">
  <title></title>
  <script src="../js/angular.js"></script>
  <script>
    angular.module('formExample', [])
        .controller('FormController', ['$scope', function($scope)
        {
        }]);
  </script>
  <style>
    .strike {
      text-decoration: line-through;
    }
    .bold {
      font-weight: bold;
    }
    .red {
      color: red;
    }
  </style>
</head>
<body>
<div>
  <p ng-class="{strike: deleted, bold: important, red: error}">通過映射的方式</p>
  <input type="checkbox" ng-model="deleted">添加strike樣式<br>
  <input type="checkbox" ng-model="important">添加bold樣式<br>
  <input type="checkbox" ng-model="error">添加錯(cuò)誤樣式
  <hr>
  <p ng-class="style">使用字符串的方式</p>
  <input type="text" ng-model="style" placeholder="輸入 bold、 strike 或 red">
  <hr>
  <p ng-class="[style1, style2, style3]">使用數(shù)組的方式</p>
  <input ng-model="style1" placeholder="輸入: bold, strike 或 red"><br>
  <input ng-model="style2" placeholder="輸入: bold, strike 或 red"><br>
  <input ng-model="style3" placeholder="輸入: bold, strike 或 red"><br>
  <hr/>
</div>
</body>
</html>

更多關(guān)于AngularJS相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《AngularJS指令操作技巧總結(jié)》、《AngularJS入門與進(jìn)階教程》及《AngularJS MVC架構(gòu)總結(jié)

希望本文所述對大家AngularJS程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評論

永吉县| 扎兰屯市| 玛沁县| 南城县| 仁寿县| 息烽县| 岳阳市| 三河市| 庆城县| 汉川市| 伽师县| 瑞丽市| 平潭县| 天津市| 九台市| 佛教| 景泰县| 韩城市| 瑞安市| 衡南县| 奉新县| 伊金霍洛旗| 丰原市| 泽普县| 原平市| 伊金霍洛旗| 黄山市| 峡江县| 邵东县| 固安县| 花莲县| 兴山县| 浦江县| 香河县| 林州市| 门头沟区| 榆林市| 张家川| 黄大仙区| 游戏| 逊克县|