Anton
Anton

Reputation: 796

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>

Upvotes: 0

Views: 318

Answers (1)

rtn
rtn

Reputation: 2034

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

Just remember to set getSectionData.isGood = true; early on and when you want to show the other tab set 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}}. Which mean the attribute will see active="true" instead of active="getSectionData.isGood".

Upvotes: 1

Related Questions