ng-switch

    <p>ng-switch : </p>
    <div ng-switch="isShow"><!--isShow是boolean值-->
        <div ng-switch-when='false'>false显示</div>
        <div ng-switch-when="true">true显示</div>
        <div ng-switch-default>default显示</div>
    </div>
    <div ng-switch="selection"><!--selection有具体值-->
        <div ng-switch-when="settings div">settings div</div>
        <div ng-switch-when="home span">home span</div>
        <div ng-switch-default>other</div>
    </div>
    <div ng-switch on="selection"><!--selection有具体值   on-->
        <div ng-switch-when="settings div">settings div</div>
        <div ng-switch-when="home span">home span</div>
        <div ng-switch-default>other</div>
    </div>
$scope.isShow = false;
$scope.items = ['settings div','home span','other','random'];
$scope.selection = $scope.items[0];//初使化

selection的值不同会显示不同的数据;

posted @ 2016-11-22 11:29  Amy-WebFrontEnd  阅读(182)  评论(0编辑  收藏  举报