zoukankan      html  css  js  c++  java
  • angular之隐藏显示,CSS类和样式

    直接上代码

    <body ng-app='app'>

    <div ng-controller="showHideController">
    <button ng-click="show()">按钮</button>
    <ul ng-show="isShow" class="color-{{isDis}}">
    <li>111</li>
    <li>111</li>
    <li>111</li>
    <li>111</li>
    </ul>

    </div>

    <div ng-controller="cssController">
    <div ng-class="{error:isError,warning:isWarning}">{{msgText}}信息</div>
    <button ng-click="showError()">error</button>
    <button ng-click="showWarn()">waring</button>
    </div>

    </body>

    angular.module('app',[])

    .controller('showHideController',function($scope){
    $scope.isShow=false;
    $scope.isDis=false;
    $scope.show = function(){
    $scope.isShow=!$scope.isShow
    $scope.isDis=!$scope.isDis
    }
    })
    .controller('cssController',function($scope){
    $scope.isError=false;
    $scope.isWarning = false;
    $scope.showError = function(){
    $scope.msgText="this is error!!"
    $scope.isError=true;
    $scope.isWarning = false;
    }
    $scope.showWarn = function(){
    $scope.msgText="this is warn!!"
    $scope.isError=false;
    $scope.isWarning = true;
    }
    })

    css

    .color-true{
    color: red;
    }
    .color-false{
    color:#000000;
    }
    .error{
    color: red;
    }
    .warning{
    color: yellow;
    }

  • 相关阅读:
    [CF1076D] Edge Deletion
    [CF1081D] Maximum Distance
    [CF1095F] Make It Connected
    [CF1328E] Tree Queries
    [CF1328F] Make k Equal
    Codeforces Round #629 (Div. 3) 总结
    [CF1131D] Gourmet choice
    [CF1176D] Recover it!
    [CF1205B] Shortest Cycle
    [CF1213G] Path Queries
  • 原文地址:https://www.cnblogs.com/Eplayed/p/5431077.html
Copyright © 2011-2022 走看看