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
我不知道如何使用它们。我尝试使用$ scope从js文件到达它们但它没有用
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.
请以某种方式帮助我如何使用$ scope从javascript或其他含义中选择标签内容。
1 个解决方案
#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.
选项卡的select属性是激活选项卡时调用的函数回调。您正在寻找的是活动属性,它指的是控制选项卡激活的布尔属性。
<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).
标签将被激活。激活后,它将触发函数alertMe(在示例中它显示警报)。
#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.
选项卡的select属性是激活选项卡时调用的函数回调。您正在寻找的是活动属性,它指的是控制选项卡激活的布尔属性。
<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).
标签将被激活。激活后,它将触发函数alertMe(在示例中它显示警报)。