简体   繁体   English

当第一个标签处于活动状态时,第二个则不起作用

[英]when first tab is active, second doesn't work

I have a couple tabs in my page, The first tab is default but second should be open if some some data is wrong. 我的页面上有几个选项卡,第一个选项卡是默认选项卡,但是如果某些数据错误,则第二个选项卡应该打开。 I've been tried to set default tab thru expression but, if expression is working and the second tab is open, click on the first tab doesn't work, What I'm doing wrong? 我已经尝试通过表达式设置默认选项卡,但是,如果表达式可以正常工作并且第二个选项卡处于打开状态,请单击第一个选项卡不起作用,我在做什么错了?

 <uib-tab heading="First Tab" active ="true">
     <div>blah blah blah  content...</div> 
 </uib-tab>

 <uib-tab heading="Second Tab" active ="!(getSectionData.isGood)">
     <div>blah blah blah content 2...</div>
 </uib-tab>

</uib-tabset>
 <uib-tab heading="First Tab" active ="getSectionData.isGood">
     <div>blah blah blah  content...</div> 
 </uib-tab>

 <uib-tab heading="Second Tab" active ="!getSectionData.isGood">
     <div>blah blah blah content 2...</div>
 </uib-tab>

</uib-tabset>

Use your existing variables. 使用现有变量。 When getSectionData.isGood is true the default one will be shown and when getSectionData.isGood is false the other own will be shown. 当getSectionData.isGood为true时,将显示默认值;当getSectionData.isGood为false时,将显示另一个值。

Just remember to set getSectionData.isGood = true; 只要记住将getSectionData.isGood = true;设置为getSectionData.isGood = true; early on and when you want to show the other tab set getSectionData.isGood = false; 尽早,当您想显示另一个选项卡集时, getSectionData.isGood = false; . It will flip round which one is active. 它将翻转哪一个处于活动状态。

Also you do not need () around expressions. 另外,您不需要在表达式周围使用()。 If you want to evaluate and expression you might have to do {{getSectionData.isGood}} . 如果要评估和表达,则可能必须执行{{getSectionData.isGood}} Which mean the attribute will see active="true" instead of active="getSectionData.isGood" . 这意味着该属性将看到active="true"而不是active="getSectionData.isGood"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM