Abdulrhman Alsri
Abdulrhman Alsri

Reputation: 1727

select() function in tabs - Angular Bootstrap

Look at this there is tab component. In the tab setting there is:

select()

and

deselect()

I did not know how to use them. I tried to reach them from js file using the $scope but it did not work

HTML

<tab ng-model="Tab1" ....>

js

$scope.Tab1.select();

but it does not select the content of that tab.

please help me in a way how can I select tab content from the javascript or in other meaning using $scope.

Upvotes: 0

Views: 101

Answers (1)

XelharK
XelharK

Reputation: 609

You misunderstood what that function is.

The select property of a tab is a function callback that is called when the tab is activated. What you are looking for is instead the active property, which refers to the boolean property that controls the activation of the tab.

<tabset>
    <tab select="alertMe()" active="Tab1.active">
        <tab-heading>
            <i class="glyphicon glyphicon-bell"></i> Alert!
        </tab-heading>
    </tab>
</tabset>

So, in this example, you can do

$scope.Tab1.active = true;

And the tab will be activated. Upon activation, it will fire the function alertMe (in the example it displays an alert).

Upvotes: 1

Related Questions