twitter-bootstrap UIB 选项卡 - 设置第二个选项卡处于活动状态
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36011804/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 23:45:01 来源:igfitidea点击:
UIB tabs - set second tabs is active
提问by senthil
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.
它是 uib 引导插件。默认激活第一个选项卡。我需要将第二个选项卡设置为默认活动。请尽快帮助我。
<!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>
回答by daniel
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.
做你需要的。
Updatedplunker
更新的plunker

