angluarjs的tab标签

JS代码

 $scope.tabs = [];
$rootScope.data = {
            current: "3" // 1代表张三,2代表李四,3代表王五
        };
        $rootScope.actions =
        {
            setCurrent: function (param) {
                $rootScope.data.current = param;
            }
        }

$scope.tabs.push({ title: '工作组', current: 2, show: true });
$scope.tabs.push({ title: '个人', current: 3, show: true });

 html代码

<ul class="nav nav-tabs">
            <li role="presentation" ng-repeat="tab in tabs" ng-class="{ 'active' : data.current == tab.current }"><a href="" ng-click="actions.setCurrent(tab.current)">{{tab.title}}</a></li>
</ul>

  

posted @ 2018-05-14 09:15  Sagacity_shen  阅读(122)  评论(0编辑  收藏  举报