10. tab切换案例的实现

2017-10-15  本文已影响0人  小草莓蹦蹦跳
<div ng-switch="type">
        <div ng-switch-when="html">![](image/01.png)</div>
        <div ng-switch-when="ios">![](image/02.png)</div>
        <div ng-switch-when="java">![](image/03.png)</div>
        <div ng-switch-when="ui">![](image/04.png)</div>
    </div>
 var app = angular.module('app',[]);
    app.controller('wmxController',['$scope',function ($scope) {
        //默认显示第一张
        $scope.type = "html";
        $scope.enter = function (args) {
            $scope.type = args;
        }
    }])
 <div class="title">
        <ul>
            <li ng-mouseenter="enter('html')" ng-class="{cur:type == 'html'}">前端学院</li>
            <li ng-mouseenter="enter('ios')"  ng-class="{cur:type == 'ios'}">ios学院</li>
            <li ng-mouseenter="enter('java')" ng-class="{cur:type == 'java'}">java学院</li>
            <li ng-mouseenter="enter('ui')"  ng-class="{cur:type == 'ui'}">UI精品学院</li>
        </ul>
    </div>
上一篇下一篇

猜你喜欢

热点阅读