0

In this plunk I have three tabs that are created from an array. When I click on the button, I need the one named "Name 1" to be selected and have the focus. How can this be achieved?

HTML

<uib-tabset>
   <uib-tab ng-repeat="t in tabs" heading="{{t.title}}" >
     {{t.content}}
   </uib-tab>
</uib-tabset>


<br/><br/><br/>
<button ng-click="tabs.select(1)">Focus on Name 1</button>

Javascript

  $scope.tabs = [
    { title:'Name 0', content: "Content 0" },
    { title:'Name 1', content: "Content 1" },
    { title:'Name 2', content: "Content 2" }
  ];

1 Answer 1

4

You have to setting the active attribute, as below:

<uib-tabset active="active">

Then in your button:

<button ng-click="active = 1">Focus on Name 1</button>

Here's the forked Plunker.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.