angularjs教程——Dom操作相关指令详解

一、ng-show/ng-hide

<div ng-show="true">{{text}}</div>  //显示
<div ng-show="false">{{text}}</div>//隐藏

二、ng-if

三、ng-switch

<!DOCTYPE HTML>
<html ng-app='myApp'>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="angular.min.js"></script>
<style type="text/css">
.red{ background:red;}
.yellow{ color:yellow;}
</style>
<script>
var m1=angular.module('myApp',[]);

m1.controller('Aaa',['$scope',function($scope){
  $scope.bBtn=true;
  
}]);

</script>
<title>无标题文档</title>
</head>

<body>
<div ng-controller="Aaa">
<input type="checkbox" ng-model="bBtn">
  <div ng-switch on="bBtn">
    <p ng-switch-default>默认的效果</p>
    <p ng-switch-when="false">切换的效果</p>
  </div>
</div>
</body>
</html>

四、ng-open

 

posted @ 2016-10-14 15:45  cacti_vc  阅读(211)  评论(0编辑  收藏  举报