3

I am using Angular with Twitter Bootstrap Nav Tabs and want to be able to enable/action things based on the active tab.

This fiddle shows my basic structure: 

fiddle

What I want to do is on the Details tab, only load or process the content if the tab is activated.

At the moment there is a delay/processing overhead when the contents of the Details tab is loaded as it is quite processor intensive. It is fairly small but adds up to quite a delay when all the row of tabs are rendered in the working copy. The example only shows 3 rows but a normal page would have about 10. Since the user is unlikely to want to click on the Details tab on every row, I would like the content activated or loaded whenever the tab is selected.

Any ideas on how to implement this?

3
  • If you use ui-bootstrap your select attribute will be an expression you can use to load the content. Commented Dec 17, 2014 at 22:41
  • use ng-if like <div ng-if="option=='details'" ng-include="/details"> Commented Dec 17, 2014 at 23:57
  • @Aidin perfect! that worked. I will accept that as the answer if you add it. Commented Dec 18, 2014 at 16:22

1 Answer 1

3

You can use a combination of ng-if and ng-include tags to lazy load contents

<div ng-if="option=='details'" ng-include="/details">
</div>
Sign up to request clarification or add additional context in comments.

Comments

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.