var m1 =angular.module('myApp',[]);m1.controller('Aaa',['$scope',function($scope){$scope.bBtn =true;}]);
<div ng-controller="Aaa">
<input type="checkbox" ng-model="bBtn">
<div ng-show="bBtn">aaaaaaaaaaaa</div>
<div ng-if="bBtn">aaaaaaaaaaaa</div>
<div ng-switch on="bBtn">
<p ng-switch-default>默认的效果</p>
<p ng-switch-when="false">切换的效果</p>
</div>
<details ng-open="bBtn">
<summary>Copyright 2011.</summary>
<p>All pages and graphics on this web site are the property of W3School.</p>
</details>
</div>
初始化数据指令
ng-init
标签内定义一下数据。
div ng-controller="Aaa" ng-init="text='hello'">
{{ text }}
</div>-->
<div ng-controller="Aaa">
<div ng-repeat="arrOuter in arr" ng-init="outerIndex = $index">
<div ng-repeat="arrInner in arrOuter" ng-init="innerIndex = $index">
<p>{{arrInner}}:{{outerIndex}}{{innerIndex}}</p>
</div>
</div>
</div>
var m1 =angular.module('myApp',[]);m1.controller('Aaa',['$scope',FnAaa]);functionFnAaa($scope){}FnAaa.prototype.num ='123';FnAaa.prototype.text ='hello';FnAaa.prototype.show=function(){return'angularJS';};
<div ng-controller="FnAaa as a1">
<div>{{a1.text}}:{{a1.show()}}</div>
</div>