2017-06-29 121 views
0

所以我將按鈕組轉換爲Bootstrap選項卡,然後我的一個視圖停止出現。我無法弄清楚我做錯了什麼,但是我認爲我已經縮小到Tab隱藏時重置我的模型的Tab。下面是我有:Bootstrap選項卡隱藏我的模型

控制器:

$ctrl.$onInit = function() { 
    $ctrl.states = [ // for toggling which view to display 
     'state0', // 0 
     'state1', // 1 
     ... 
    ]; 
    $ctrl.currentState = $ctrl.states[3]; // this should show my forth view 
}; 

查看:

<!-- setting to false for testing --> 
<div class="panel-body desktop hidden-xs hidden-sm" ng-show="false"> 
    <!-- here I use currentState to determine which one is active --> 
    <uib-tabset active="$ctrl.currentState" type="tabs" justified="true"> 
     <uib-tab heading="Some Text" index="'state0'"> 
      <div class="text-center text-primary">Fields Marked With * Are Required.</div> 
     </uib-tab> 
     ... 
    </uib-tabset> 
</div> 

當標籤被隱藏currentState被設置爲「」和我的其他視圖不顯示。

視圖2:

<div class="panel-body" ng-show="$ctrl.currentState === 'state4'"> 
    ... 
<div> 

我如何禁用此行爲?我已經做了一些研究,但是我還沒有發現任何人有這個問題。提前致謝。

回答

0

我想沒有人遇到過這個問題。儘管我找到了一個解決方法。

我添加了一個新標籤,我不顯示。

<uib-tab heading="Some Text" index="'state4'" ng-show="false"> 
</uib-tab> 

由於此狀態現在存在一個標籤,我的currentState變量不會被清除。我想爲此更好的回答,但現在至少有功能。