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>
sagacity_shen
战战兢兢,如履薄冰。