Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIB tabs - set second tabs is active

Its is uib bootstrap plugin. Default active the first tab. I need to set the second tab is default active. Kindly help me as soon as possible.

  <!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>
like image 743
senthil Avatar asked Mar 15 '16 12:03

senthil


1 Answers

Something like:

<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>

does what you need.

Updated plunker

like image 150
daniel Avatar answered Nov 11 '22 08:11

daniel