Aanchal Aanchal - 1 year ago 40
AngularJS Question

Button inside one static tab to show second tab is not working when using angular ui bootstrap

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-

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


I have created a plunker here-

Can anyone tell me how can I achieve this?

Answer Source

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;