rpocklin / ui-router-tabs

Idiot-proof tab panes with route support using Angular.js + Bootstrap 3 + UI Router
Other
244 stars 57 forks source link

Delayed tab state resolves possible? #83

Closed skidvd closed 8 years ago

skidvd commented 8 years ago

I have a set of tabs using these very helpful (thank you!) directives that is working fine. However, I have run across a new consideration that I am hoping you may be able to offer some thoughts or ideas on please?

The scenario is a follows:

This works/functions just fine. However, I am noting that the resolves for ALLroutes/states are hit upon display of the tabset (even though obviously only a single tab is active/displayed at a time). This is normally not an issue; but, when the resolves are extensive and/or long running in nature, this is inefficient and may delay display of the targeted/active tab until the longest resolve has finished.

Any thoughts on how one might delay execution of the non-targeted tabs unit and if they are actually ever actived?

I attempted to use the tab.active value in combination with ng-if on the ui-view as shown below, but this did not delay or preclude the resolves for the non-active routes/states.

`

{{::tab.heading}} {{tab.newCount}} {{tab.actionCount}} {{tab.warningCount}}

`

Any other ideas, suggestions or better approaches would be appreciated please!

TIA!!!

skidvd commented 8 years ago

Upon further investigation, I have determined that this issues does NOT happen with using standard ui-router states associated with the 'route' attribute for the tab. It only occurs when using ui-router views to populate the tab contents with. In that case, loading them all simultaneously may be the expected behavior. However, if there are ideas to delay resolve loading even in that case, I'd still be interested in hearing about them.

Apologies for the confusion.