在设置引导角初始静态标签 [英] Setting the initial static tab in angular bootstrap

查看:138
本文介绍了在设置引导角初始静态标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎不能够设置在角度引导标签集的inital标签。它总是将最左侧的选项卡活跃。

I don't seem to be able to set the inital tab in an angular bootstrap tabset. It always sets the left most tab to active.

由于HTML:

<tabset>
    <tab heading="Static 1" active="data.static1">Static content</tab>
    <tab heading="Static 2" active="data.static2">Static content</tab>
</tabset>

和JS:

angular.module('plunker', ['ui.bootstrap']);
var TabsDemoCtrl = function ($scope) {
  $scope.data = {static1: false, static2: true}
};

查看 Plunker

更新2013年8月6日:现在上游固定看 GitHub的问题

Update 6 Aug 2013: Now fixed upstream see the github issue.

推荐答案

这似乎是(静态)选项卡覆盖无论是转成积极的运行指令时。我认为这是一个错误。快速和肮脏的,你可以使用一个超时以0秒延时设定活动状态。至少在plunkr,这不会导致任何闪烁。在你的控制器:

It seems like (static) tabs overwrite whatever is passed to active when the directive is run. I assume it's a bug. Quick and dirty, you can use a timeout with 0 seconds delay to set the active state. At least in the plunkr, this does not cause any flicker. In your controller:

$scope.data = {};
$timeout(function() {
  $scope.data.static2 = true;  
}, 0)

http://plnkr.co/edit/3KbdKh?p=$p$pview

这篇关于在设置引导角初始静态标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆