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;
    }

  • 相关阅读:
    CF1137C Museums Tour(tarjan+DP)
    Educational Codeforces Round 65 (Rated for Div. 2)
    Codeforces Round #559(Div.1)
    委托
    类库
    is 和 as 运算符
    面向对象 接口
    抽象类
    面向对象 多态
    访问修饰符 程序集 静态方法
  • 原文地址:https://www.cnblogs.com/Eplayed/p/5431077.html
Copyright © 2011-2022 走看看