当使用角度ui引导时,显示第二个选项卡的静态选项卡中的按钮无效

时间:2023-01-21 12:06:16

I want that on clicking a button inside one static tab would take me to another tab. I am trying using angular ui bootstrap but it is not working. I am using below code but it is not working-

我想要在一个静态选项卡内点击一个按钮就会把我带到另一个选项卡。我尝试使用角ui引导,但它不起作用。我正在使用下面的代码,但它不能工作-

 <uib-tab index="0" heading="Static title">Static content
      <button class="btn btn-default btn-sm" ng-click="tabs[2].active = true">Select third tab</button>

   </uib-tab>

I have created a plunker here- https://plnkr.co/edit/dTdsbeWbWiIqvmjh2IY8?p=preview

我在这里创建了一个柱塞器——https://plnkr.co/edit/dtdsbewbwiiqvmjh2iy8?

Can anyone tell me how can I achieve this?

谁能告诉我我该怎么做吗?

1 个解决方案

#1


2  

I tried this and it worked.

我试过了,它成功了。

<button class="btn btn-default btn-sm" ng-click="secondTab()">Select second tab</button>

In controller:

控制器:

$scope.secondTab = function(){
  $scope.active = 2;
}

https://plnkr.co/edit/wZ8yIkjvoLO82wvG5UBc?p=preview

https://plnkr.co/edit/wZ8yIkjvoLO82wvG5UBc?p=preview

#1


2  

I tried this and it worked.

我试过了,它成功了。

<button class="btn btn-default btn-sm" ng-click="secondTab()">Select second tab</button>

In controller:

控制器:

$scope.secondTab = function(){
  $scope.active = 2;
}

https://plnkr.co/edit/wZ8yIkjvoLO82wvG5UBc?p=preview

https://plnkr.co/edit/wZ8yIkjvoLO82wvG5UBc?p=preview