UIB选项卡 - 设置第二个选项卡处于活动状态

时间:2016-03-15 12:48:43

标签: jquery angularjs twitter-bootstrap

它是uib bootstrap插件。默认激活第一个选项卡。 我需要设置第二个选项卡是默认活动的。请尽快帮助我。

  <!doctype html>
    <html ng-app="ui.bootstrap.demo">
    <head>
        <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.js"></script>
        <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular-animate.js"></script>
        <script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-1.2.4.js"></script>
        <script type="text/javascript">
        angular.module('ui.bootstrap.demo', ['ngAnimate', 'ui.bootstrap']);
        angular.module('ui.bootstrap.demo').controller('TabsDemoCtrl', function($scope, $window) {

        });
        </script>
        <link href="http://netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    </head>
    <body>
        <div ng-controller="TabsDemoCtrl">
            <uib-tabset active="active">
                <uib-tab index="0" heading="Static title">Static First</uib-tab>
                <uib-tab index="1" heading="Static title1">Static Second</uib-tab>
                <uib-tab index="2" heading="Static title2" active="true">Static Third</uib-tab>
            </uib-tabset>
        </div>
    </body>
    </html>

1 个答案:

答案 0 :(得分:11)

类似的东西:

<div ng-controller="TabsDemoCtrl" ng-init="indextab = 1">
    <uib-tabset active="indextab">
        <uib-tab index="0" heading="Static title">Static First</uib-tab>
        <uib-tab index="1" heading="Static title1">Static Second</uib-tab>
        <uib-tab index="2" heading="Static title2" active="true">Static Third</uib-tab>
    </uib-tabset>
</div>

做你需要的。

已更新 plunker