0

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.

1 Answer 1

1

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

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

6 Comments

What I want is to display the content of the tab as I said in the last line in my post. I want the event to open the tabl as I click on it using mouse when another tab is shoing content/open/clickerd.
Yes. As I said, you have to bind that tab "active" property with some property (for example, Tab1.active). Then, when you use $scope.Tab1.active = true that tab will become active. Also, the tab-heading does the same thing you want, it's just its default behavior.
Thank you for reply @XelharK. I understood your point, but I will appreciate your if you help me in my last explanation. I think I will edit my question also.
for your second reply, I can answer you that the tab is not opening as you click on it, it opens its content. That just makes it active. Did you get my point?
I want to show display the tab content not activating it based on an event @Xelhark
|

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.